Java SE 8 Programmer II Practice Questions

Previous   Next

8.Given the following:

1     public class exp
2
3     {
4     int base_value;     
5
6     private void test(int y)
7     {
8          assert(y>0):"Error , value less than 0";
9          base_value=y;
10     }
11     public void check(int x)
12     
13     {
14          test(x);
15     }
16     
17     public static void main(String args[])
18     
19     {
20          exp e=new exp();
21          e.check(0);
22     
23     }
24
25     }     

After the following commands:

     javac -source 1.6 exp.java
     java exp

What is the result?
No output

Program fails to compile

Exception thrown at run time

"Error, value less than 0" will be added to the top of stack trace/




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