Question 48Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

Which of the following is the correct way to declare a variable in Java?

  1. Alet x = 10;
  2. Bx = 10;
  3. Cvar x = 10;
  4. Dint x = 10;
Show answerHide answer

Correct answer: (D) int x = 10;

Explanation

Java is statically typed, so a variable is declared with its type: int x = 10;. let is JavaScript, and var x = 10 works only as local type inference from Java 10, so the standard answer is int.

From DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

This is question 48 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 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.