System.out.println(1+2+"3");
System.out.println("1"+2+3);
output:-
33
123
First case is understood but the second case is not clear.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If we are doing + operation in string then is works as append(concatenation).
So in your first case
1+2+"3"…1+2 =3but when it perform3+"3"java concate 3 into String 3 that is 33.and in second example
"1"+2+3… 2 is append into String “1” that results as12and then"12" + 3so result is =123.