Regarding Question : com.enthuware.ets.scjp.v6.2.35

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

Regarding Question : com.enthuware.ets.scjp.v6.2.35

Post by ETS User »

I believe that for the option 3 the correct answer should be : "Will not compile" as there is no indication that a ClassNotFoundException is thrown anywhere, either at the method level or in try/catch block. Assuming this is done, the provided answer is correct.

ETS User

Re: Regarding Question : com.enthuware.ets.scjp.v6.2.35

Post by ETS User »

Why nobody answers my question?? Because answer is obviously wrong???

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

Re: Regarding Question : com.enthuware.ets.scjp.v6.2.35

Post by admin »

Hello,
I see that Option 3 is set to "No exception will be thrown", which is correct.

Regarding the time it took for responding, different question banks are supported by different people so it is possible that one question may be answered before another. We try to answer as soon as possible but it is not always possible to respond immediately. Rest assured that each question will be answered.

HTH,
Paul.

ETS User

Re: Regarding Question : com.enthuware.ets.scjp.v6.2.35

Post by ETS User »

That's simply not correct. I explained why.

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

Re: Regarding Question : com.enthuware.ets.scjp.v6.2.35

Post by admin »

The question asks you to identify the exception that will be thrown by the given line of code:

Code: Select all

Class.forName("java.lang.String"); 
This line of code has no compilation issue as such and it will not throw any exception either.

It is correct that try/catch or throws clause is not shown. But the question is only asking about the given line and not the whole code. If you think that way, then none of the given options will compile because there is no class statement, no method, or no body for any of the code fragments. One may also think that the code may be in a file with an inappropriate name. There can be several things, which are not specified in the question, that can go wrong. But you don't have to consider that. You just need to consider the code fragment that is given and assume that everything else is valid.

The questions in the exam expect you to assume the same thing. i.e. things that are not specified are valid.

HTH,
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests