What is output with the statement System.out.println(""+x+y); if x and y are int values where x=10 and y=5?


What is output with the statement System.out.println(""+x+y); if x and y are int values where x=10 and y=5?


a) 15

b) 105

c) 10 5

d) x+y

e) An error since neither x nor y is a String

Answer: b. Explanation: The "" casts the rest of the expression as a String, and so the two + signs are used as String concatenation, and so x + y becomes x concatenated with y, or 105.