M

Mr. Dubey • 96.25K Points
Coach

Q. What will be the result of compiling the following code?~~~public class Test~~~{~~~static int age;~~~public static void main (String args [])~~~{~~~age = age + 1;~~~System.out.println("The age is " + age);~~~}~~~}

  • (A) Compiles and runs with no output.
  • (B) Compiles and runs printing out The age is 1.
  • (C) Compiles but generates a runtime error.
  • (D) Compiles but generates a compile time error.
  • Correct Answer - Option(B)
  • Views: 103
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics