venerdì 11 aprile 2014

Java 7 OCA 1z0-803: What is the result?

Given the following:
class Y {
 public static void main(String args[]) {
  int x = 0, y = 5;
  
  try {
   y /= x;
  }
  System.out.print("Divide by 0");
  catch (Exception e) {
   System.out.print("error");
  }
 }
}
What is the result?
A - 0
B - Error.
C - Compilation fails.
D - An uncaught exception is thrown at runtime.
E - No output.
Answer: C
More questions about Java 7 OCA 1z0-803?