Q. What is the output of System.out.println(‘a’ + ‘b’);?

A
ab
B
195
C
2
D
error
Solution:

Char values are added as their ASCII values (97 + 98 = 195) when not concatenated with a string.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!