iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

958 questions | 100% Free

Q.21Medium

What will be the output: System.out.println('A' + 'B');

Q.22Medium

What is the output of: int x = 5; System.out.println(++x + x++);

Q.23Medium

Which of the following correctly represents a long literal in Java?

Q.24Easy

What will be printed? float f = 5.5f; System.out.println(f);

Q.25Medium

What is the result of: System.out.println(true && false || true);

Q.26Medium

Which of the following statements will compile successfully?

Q.27Medium

What is the output of: System.out.println(10 * * 2);

Q.28Easy

Which of the following is the correct syntax for a multi-line comment in Java?

Q.29Easy

What will be the output: String s = "Hello"; System.out.println(s.charAt(1));

Q.30Medium

What is the output of: System.out.println("5" + 3 + 2);

Q.31Medium

Which of the following correctly initializes a 2D array in Java?

Q.32Medium

What will be the output: int a = 10; int b = 20; System.out.println(a > b ? "A" : "B");

Q.33Medium

What is the output of: double d = 5.7; int i = (int) d; System.out.println(i);

Q.34Medium

Which statement about Java's 'this' keyword is correct?

Q.35Easy

What will be the output of: System.out.println(Math.max(5, 10) - Math.min(3, 8));

Q.36Easy

Which of the following is NOT a valid Java identifier?

Q.37Easy

Which keyword is used to prevent method overriding in Java?

Q.38Easy

Which of the following statements about Java packages is correct?

Q.39Medium

What is the difference between == and .equals() for String comparison?

Q.40Medium

Which access modifier allows access within the same package and subclasses?