About Question enthuware.ocpjp.i.v11.2.1321 :

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

Moderator: admin

Post Reply
lazyf1sh
Posts: 2
Joined: Mon Nov 30, 2020 1:59 pm
Contact:

About Question enthuware.ocpjp.i.v11.2.1321 :

Post by lazyf1sh »

Hi,

it seems there is a misconception. Missing file extension as in viewtopic.php?f=2&t=5736

Correct option is "It will throw an exception and end without printing anything.", because it is throws the exception.

Code: Select all

C:\1\projects\sandbox-java\sandbox-java11-cmdline\casetwo>java Parser one
Error: Could not find or load main class Parser
Caused by: java.lang.ClassNotFoundException: Parser

Code: Select all

C:\1\projects\sandbox-java\sandbox-java11-cmdline\casetwo>java Parser.java one
Parser.java:8: error: cannot find symbol
          System.out.println("Problem in " + i );
                                             ^
  symbol:   variable i
  location: class Parser
1 error
error: compilation failed
Thanks.

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

Re: About Question enthuware.ocpjp.i.v11.2.1321 :

Post by admin »

You will see the same pattern in the real exam as well. If the problem statement is talking about execution, it implies that it is executing the class file and not the java file. You need to assume that the code has been compiled (unless the options refer to compilation errors).
In this case, the option "It will not compile" is the correct option because the code doesn't compile.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests