ProgrammingHardInfosys DSE · Wipro Elite

What is printed?

What is printed?
System.out.print('a' + 'b' + "c" + 'a' + 'b');
  1. A. abcab
  2. B. 195cab
  3. C. 195c195
  4. D. cabcab

Correct answer: B. 195cab

'a' + 'b' is int addition (195); after the first String operand, + is left-associative concatenation of the char values.

More OOP with C++ and Java questions

Exams that ask this topic