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) Does not compile
E) Compiles but generates a compile time error

Showing Answers 1 - 1 of 1 Answers

surya

  • Jan 8th, 2006
 

Answer : B

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions