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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

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

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

Post by lazyf1sh »

Hi,

it seems there is a mistake. Correct option is "None of the above.", because it is throws the exception.

Code: Select all

public class MyClass
{
	public static void main(String[] args)
	{
		System.out.println(args[0]);
	}
}
java version:

Code: Select all

C:\1\projects\sandbox-java\sandbox-java11-cmdline>java -version
java version "11.0.9" 2020-10-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.9+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.9+7-LTS, mixed mode)
Without extension.

Code: Select all

C:\1\projects\sandbox-java\sandbox-java11-cmdline>java MyClass hi
Error: Could not find or load main class MyClass
Caused by: java.lang.ClassNotFoundException: MyClass
Also tried to rename from MyClass.java to MyClass - it didn't help. Java source class must have .java extension and it must be specifed in the command.


Filename extension is required when running single file source code.

Code: Select all

C:\1\projects\sandbox-java\sandbox-java11-cmdline>java MyClass.java hi
hi
Thanks.

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

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

Post by admin »

You are right, the problem statement has been updated to include the words, "compiled and then run" instead of just "run".
BTW, Single File source code execution is not on 819 exam any more so, you have to assume that the code is compiled and then run unless explicitly said otherwise.

thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests