McqMate
| 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. | |
View all MCQs in
Java ProgrammingNo comments yet