Question: 1 (a) Look at the source code below and answer the following questions: 11 // Approach A 2 if (my Reference != null) { /*

 1 (a) Look at the source code below and answer the

1 (a) Look at the source code below and answer the following questions: 11 // Approach A 2 if (my Reference != null) { /* Handle null */ } 3 else { System.out.println(myReference.getID()); } // Approach B 6 try 7 { 8 System.out.println(myReference.getID()); 10 catch(NullPointerException npe) { /* Handle null */ } i. Is NullPointerException a checked exception? ii. Which approach (A or B) is the correct way to process a NullPointerException? iii. Provide a reason why you would this approach. (b) Discuss the advantages and disadvantages of Automatic Resource Management. [01] [02] [02] [05]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!