Page 1 of 1
About Question enthuware.ocajp.i.v8.-2-.1214 :
Posted: Sun Oct 09, 2016 6:01 am
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".
Re: About Question enthuware.ocajp.i.v8.2.1214 :
Posted: Sun Oct 09, 2016 9:39 am
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.
Re: About Question enthuware.ocajp.i.v8.2.1214 :
Posted: Thu Mar 05, 2020 10:34 am
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