Java SE 8 Programmer II Practice Questions

Previous   Next

2. Given:

1     public class test
2     {
3          static int i=0;
4          test()
5          {
6          i++;
7          }
8          
9     public static void main(String args[])
10     {
11     test t=new test();
12      System.out.print(test.i);
13     test t1=new test();
14     System.out.print(test.i);
15     test t2=new test();
16     System.out.print(test.i);
17     }
18     }

 What is the result?
1 1 1

0 0 0

1 2 3




Your Answer =


Answer / Explanation:

CertExams Blog!  Certexams.com Facebook Page Certexams.com Twitter Page Certexams on YouTube 


Cert-Ex™ Exam Simulators, Cert-Ex™ Network Simulator, Cert-Ex™ Cheatsheets are written independently by CertExams.com and not affiliated or authorized by respective certification providers. Cert-Ex™ is a trade mark of CertExams.com or entity representing Certexams.com.Java™ is a trademark of Oracle® Corporation