Question: Java NetBeans project ***please show solution**** public class JavaApplication1 { public static void main(String[] args) { RuntimeException exception = null; throw exception; } } Test
Java NetBeans project ***please show solution****
public class JavaApplication1 {
public static void main(String[] args) {
RuntimeException exception = null;
throw exception;
}
}
| Test Stem / Question | Choices |
| What is the problem with the above code? | A: null exception cannot be thrown |
| B: the main method must be declared with throws statement | |
| C: It is illegal to throw an exception | |
| D: Nothing is wrong | |
| How should you fix the code? Choose from the following:
| A: A & B |
| B: A only | |
| C: B only | |
| D: All is correct |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
