Ask Question
3 June, 22:38

Analyzing the following code:

class Test

{ public static void main (String args[])

{ NClass nc = new NClass ();

nc. t = nc. t++;

}

}

class Foo

{ int t;

private NClass ()

{ }

}

The program has a compilation error because the NClass class has a private constructor.

The program does not compile because the parameter list of the main method is wrong.

The program compiles, but has a runtime error because t has no initial value.

The program compiles and runs fine.

+2
Answers (1)
  1. 4 June, 00:20
    0
    Class NClass doesn't exist, so it won't compile.

    Explanation:

    Even if Foo would be renamed to NClass, the next problem would be the private constructor of NClass.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Analyzing the following code: class Test { public static void main (String args[]) { NClass nc = new NClass (); nc. t = nc. t++; } } class ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers