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.
Answer» B. Compiles and runs printing out The age is 1.
1.7k
0
Do you find this helpful?
20

View all MCQs in

Java Programming

Discussion

No comments yet

Related MCQs