Problem statement:
what is the output for the following code?
what is the output for the following code?
- class ExecutionTen {
- public void talk() {}
- }
- public class ExecutionNine {
- public static void main(String[] args) {
- ExecutionTen t = null;
- try {
- t.talk();
- } catch (NullPointerException e) {
- System.out.println("This is NullPointerException !");
- } catch (Exception e) {
- System.out.println("This is an Exception !");
- }
- System.out.println("Everything went fine !");
- }
- }
Output:
This is NullPointerException !
Everything went fine !
No comments:
Post a Comment