The IT Certification Resource Center

Featured Deal

Get CompTIA, Cisco, and Microsoft training courses free for a week.
Learn More ❯

Oracle Java Quiz 1

Question 2:

Given

1.  class Ex6{
2.  public static void main(String args[]){
3.    int x = 0, y=10;          
4.      try{
5.        y /=x; 
6.        }
7.    System.out.print("/ by 0");
8.      catch(Exception e){
9.        System.out.print("error");
10.      }
11.  }  } 

What is the result?

 

A. 0
B. error
C. Compilation fails
D. An uncaught exception is thrown at runtime. E. No output