About Question com.enthuware.ets.scjp.v6.2.741 :

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

Moderator: admin

Post Reply
ETS User

About Question com.enthuware.ets.scjp.v6.2.741 :

Post by ETS User »

Return type for val() method is "int" but it doesn't have a return statement. How can this compile?

static int val() throws Exception {
throw new Exception("unimplemented");
}

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

Re: About Question com.enthuware.ets.scjp.v6.2.741 :

Post by admin »

return is not the only way a method can end. In case of an exception, the method is not required to return any value. The compiler notices that this method always ends up with an exception and so does not complain for a return value.

HTH,
Paul
If you like our products and services, please help us by posting your review here.

sijucm
Posts: 8
Joined: Tue Jan 11, 2022 4:41 am

Re: About Question com.enthuware.ets.scjp.v6.2.741 :

Post by sijucm »

Great question, but are we sure Oracle people ask these kind of questions? Is these kind of code real life? Isn't that why we have computers? Do I have to remember? Of course I can remember this but then not with the breadth. If they want me to remember what Path.relativize() will do if one of the path is absolute.
These kind of things make this certification a coin toss. I'm pretty sure I can ask many questions back to the question makers that they do not know. What are we trying to prove with a certification that the person is an Artificial Intelligence, computer with no real-life skills? Sorry about this rant, but the amount of information I have to remember just so that I can forget it immediately is high.

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

Re: About Question com.enthuware.ets.scjp.v6.2.741 :

Post by admin »

Unfortunately, yes. Every aspect that we have touched upon in our questions is within the scope of the exam. You do need to learn this stuff for the exam.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: marpiva and 30 guests