About Question enthuware.ocajp.i.v8.-2-.1214 :

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
dstejskal
Posts: 1
Joined: Sun Oct 09, 2016 5:51 am
Contact:

About Question enthuware.ocajp.i.v8.-2-.1214 :

Post by dstejskal »

Hi, answer to this question is confusing for me. The value 333 is stored to String variable, so value of the variable should be "333" not 333. From this reason, I chosed answer "None of the above".

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

Re: About Question enthuware.ocajp.i.v8.2.1214 :

Post by admin »

If you take it that literally, harry is a reference and its value is actually address of the memory location where the string 333 is stored. Also, quotes are used only within the code to demarcate a String. The string does not actually contain the quotes. So even from that perspective the value is 333 and not "333".

I have updated the problem statement to make it even more clear though.
thank you for your feedback!
Paul.

DavMaher
Posts: 1
Joined: Thu Mar 05, 2020 10:28 am
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1214 :

Post by DavMaher »

public class TestClass{

public static void main(String[] args){
String tom = args[0];
String dick = args[1];
String harry = args[2];
System.out.println(args[0] + args[1] + args[2]);

// If you input the values -> 111 222 333 <- using CMD the value of args[2] is: 333
// java TestClass 111 222 333
} // End main
} // End class

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests