Page 1 of 1

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

Posted: Fri Dec 04, 2020 12:18 pm
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.

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

Posted: Fri Dec 04, 2020 9:48 pm
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.