About Question enthuware.ocajp.i.v8.-2-.1214 :
Moderators: Site Manager, fjwalraven
-
- Posts: 1
- Joined: Sun Oct 09, 2016 5:51 am
- Contact:
About Question enthuware.ocajp.i.v8.-2-.1214 :
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".
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1214 :
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.
I have updated the problem statement to make it even more clear though.
thank you for your feedback!
Paul.
-
- Posts: 1
- Joined: Thu Mar 05, 2020 10:28 am
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1214 :
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
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
Who is online
Users browsing this forum: No registered users and 5 guests