Question: Analyze the following code: public class Test {public static void main(String args[]) {NClassnc = new NClass(), nc.t = nc.t++;} class NClass {int t; private NClass()

Analyze the following code: public class Test {public static void main(String args[]) {NClassnc = new NClass(), nc.t = nc.t++;} class NClass {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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
