[Closed] What is the output of this code? System.out.print( 1+("1+1"); | Sololearn: Learn to code for FREE!

0

[Closed] What is the output of this code? System.out.print( 1+("1+1");

Can someone explain how the answer is 11+1 EDITED: What is the output of this code? System.out.print( 1+("1+1"));

1/23/2022 4:05:05 PM

User42

2 Answers

New Answer

+8

Hello RSB Maybe it will be clear if you see another example: System.out.println(5 + "hello"); output: 5hello Here happens the same when you put two strings together: "hello " + "world" -> "hello world" 1 + "1+1" the first one is just added to the string "1+1" so you get "11+1"

+5

error:System.out.print( 1+(" 1+1"); ^ expected ) 1 error