print ("not 30=", not 30)
Answers
Answered by
0
Answer:
When it evaluates what's inside the parentheses, it sees :
- a + b : the addition of two int (let's call it c)
- c + " " : an int and a String -> convert the int into a String and add the String's (let's call the result s)
- s + a : a String and an int -> same as before : converts the int into a String and add them together
- the last one (+b) works exactly the same way as the previous ones.
A way to obtains 30 30 is to write :
System.out.println(a + b + " " + (a + b));
By putting the second "a+b" in parentheses, we change the order of evaluation and this leads to adding them together before adding them to a String
Explanation:
Similar questions
Math,
5 hours ago
Geography,
5 hours ago
Math,
10 hours ago
English,
10 hours ago
Social Sciences,
8 months ago
English,
8 months ago
Social Sciences,
8 months ago