About Question enthuware.ocajp.i.v7.2.1029 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1029 :

Post by admin »

For example, if the expression to the left of the brackets is a method call and that method throws an exception.
If you like our products and services, please help us by posting your review here.

Mikhail Volkov
Posts: 8
Joined: Mon Jul 29, 2019 11:25 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1029 :

Post by Mikhail Volkov »

Guys, I think I understand... It's very easy in fact!
Look at two examples:
1) public static int[ ] getArray() { return null; } // [index=2] will work!!! This is case form question.
2) public static int[ ] getArray() { throw new RuntimeException(); } //[index=2] will not work. RTE - it is abnormal finish!

For 1:
If the array reference expression produces null(!!!!!!) instead of a reference to an array, then a NullPointerException is thrown at runtime, but only(!!!) after all parts of the array reference expression have been evaluated and only if these evaluations completed normally.
return null - it is normal finish!

For 2:
Note that if evaluation of the expression to the left of the brackets completes abruptly, no part of the expression within the brackets will appear to have been evaluated.
RunTimeException - it is abnormal finish!

Post Reply

Who is online

Users browsing this forum: No registered users and 74 guests