MCQs > IT & Programming > Java > Correct option based upon the following sample code: public class Test { static int a; int b; public Test () { int c; c = a; a++; b += c; System.out.println ('one'); } public void Test () { int c; c = a; a++; b += c; System.out.println ('two'); } public static void main (String args[]) { Test t = new Test (); } }

Java MCQs

Select the correct option based upon the following sample code:

 public class Test
 {
 static int a;
 int b;
 public Test ()
 {
 int c;
 c = a;
 a++;
 b += c;
 System.out.println ("one");
 }
 public void Test ()
 {
 int c;
 c = a;
 a++;
 b += c;
 System.out.println ("two");
 }
 public static void main (String args[])
 {
 Test t = new Test ();
 }
 }

Answer

Correct Answer: The code will compile and run successfully. It will print ''one''

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it