Sinisterly
What the output for this? - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Java, JVM, & JRE (https://sinister.li/Forum-Java-JVM-JRE)
+--- Thread: What the output for this? (/Thread-What-the-output-for-this)



What the output for this? - Yusadolat - 05-24-2014

public class logic1{

public static void main(String []args){

System.out.println( " = " +1 +2);
}
}
comment with supported reason....


RE: What the output for this? - Ex094 - 05-24-2014

Explanations are available on Google, just a search away http://stackoverflow.com/questions/11035026/system-out-printlnabc32-why-output-is-abc32-and-not-abc5


RE: What the output for this? - ThaCoderMan - 06-20-2014

This is the same way you change a int to a string, all you do is

int num = 1342;
String number = "" + num;

It is basically the same, just inputs what you put infront of it along with simply just your numbers Tongue


RE: What the output for this? - Banadmin - 06-11-2015

If you append something onto a string, then that too will become a string therefore:

Code:
public class logic1 { public static void main(String []args) { System.out.println( " = " +1 +2); } }

Will print out:

= 12