Vidyalelo
Java Programming · Q46

Strings

Programming · Java Programming · question 46

Q46

What will be output? String S1 = "S1 ="+ "123"+"456"; String S2 = "S2 ="+(123+456);

A.
S1=123456, S2=579
Answer
B.
S1=123456,S2=123456
C.
S1=579,S2=579
D.
None of This

Answer: Option A

Solution

Answer: Option A
Solution:

If a number is quoted in "" then it becomes a string, not a number any more.