0

Java System.out.println output

System.out.println((1+"1")+1+1) Why output of this statement is 1111

21st Dec 2023, 2:54 PM
Dasarath Singh
1 Réponse
+ 2
Because there is a string before the integer value (11) + 1 + 1; here 11 inside braces is a string 1111 braces has higher preference so since there is no braces before 3rd 1 so that would be go with 11 which is string If you add braces before 1 + 1 then output will be 112 System.out.println((1+"1")+(1+1));
21st Dec 2023, 3:27 PM
A͢J
A͢J - avatar