Question discussion

What is the output of the following JAVA code?

5219Medium DSSSB TGT Computer Science 0 replies 0 views
0
What is the output of the following JAVA code?
String s = "exam:" + 9 + 9 + 9;
System.out.println(s);
  • Aexam:9
  • Bexam:27
  • Cexam 27
  • Dexam:999
Correct answer: D

Explanation

In Java, + with a String concatenates, so "exam:" + 9 + 9 + 9 gives "exam:999".

Discussion 0

Nobody has replied yet. Start the discussion!