A

Admin • 828.03K Points
Coach

Q. What is the output of the following program?

Code:
public class Test{
static int x = 10 ;
public static void main(String[] a){
Test test = new Test( ) ;
Test test1 = new Test( ) ;
test.x += 1 ;
System.out.println( test.x + test1.x ) ;
}
}
  • (A) 20
  • (B) 21
  • (C) 22
  • (D) Compilation Error
  • Correct Answer - Option(C)
  • Views: 13
  • Filed under category Java
  • Hashtags:

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.

Be the first to start discuss.