+ 1

Why the output of this is a number?

System.out.print('h'+'i');

10th Jul 2018, 8:33 PM
Caty Zurano
Caty Zurano - avatar
4 Answers
+ 5
Caty Zurano double " would make it a string not a char. The result would be "hi" if it was "h" + "i"
11th Jul 2018, 7:35 AM
David Akhihiero
David Akhihiero - avatar
+ 4
Characters (chars) have integer values and using the + operator on two chars will return the sum of their Integer values
10th Jul 2018, 8:55 PM
David Akhihiero
David Akhihiero - avatar
+ 4
for this read about ASCII characters value
11th Jul 2018, 8:58 AM
Nitish kumar jha
Nitish kumar jha - avatar
+ 1
thanks!! is is the same to use simple ' or double" quotes?
10th Jul 2018, 9:25 PM
Caty Zurano
Caty Zurano - avatar