Predict the output of following Java program class Main { public static void main(String args[]) { try
Question:
Predict the output of following Java program
class Main { public static void main(String args[]) { try { throw 10; } catch(int e) { System.out.println("Got the Exception " + e); } } } | |||
Got the Exception 10 | |||
Got the Exception 0 | |||
Compile Error |
Suppose A is an inner class in Test. A is compiled into a file named ________.
A.class | ||
Test$A.class | ||
A$Test.class | ||
Test&A.class |
________ are checked exceptions.
RuntimeException | ||
Exception | ||
Throwable | ||
IOException |
A ________ method does not return a value.
void | ||
non-void |
Will the following code have a compile error? ArrayList list = new ArrayList(); list.add(3);
Yes | ||
No |
Analyze the following code:
The program displays 0 1 2 3 4. | ||
The program displays 0 1 2 3 4 and then raises a runtime exception. | ||
The program displays 0 1 2 3 4 5. | ||
The program displays 0 1 2 3 4 5 and then raises a runtime exception. |
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch