Question 176Asked in DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)

What is the output of the following code? int Integer = 24;

What is the output of the following code? int Integer = 24; char String = 'I'; System.out.print(Integer); System.out.print(String);
  1. AI
  2. BCompiler Error
  3. CThrows Exception
  4. D24I
Show answerHide answer

Correct answer: (D) 24I

Explanation

Integer and String are class names, not keywords, so they can be used as variable names. The code prints 24 and then I on the same line: 24I.

From DSSSB TGT Computer Science PYQ, 24 Jun 2023, Shift 3 (4:30 PM)

This is question 176 of DSSSB TGT Computer Science PYQ, 24 Jun 2023, Shift 3 (4:30 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.