A

Admin • 825.56K Points
Coach

Q. What will be output?

Code:
String S1 = "S1 ="+ "123"+"456";
String S2 = "S2 ="+(123+456);
  • (A) S1=123456, S2=579
  • (B) S1=123456,S2=123456
  • (C) S1=579,S2=579
  • (D) None of This
  • Correct Answer - Option(A)
  • Views: 6
  • Filed under category Java
  • Hashtags:

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.