πŸ“Š JAVA
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
πŸ’¬ Discuss
βœ… Correct Answer: (C) 22

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
247
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Prabhas Kapoor
Publisher
πŸ“ˆ
95%
Success Rate