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

Which statement about 'this' keyword is correct?

Q.22Medium

Consider: interface I1 { void method(); } interface I2 { void method(); } class C implements I1, I2 { public void method() { System.out.println("Method"); } } What will be the behavior?

Q.23Medium

What is method overloading?

Q.24Medium

Which of the following is true about abstract classes?

Q.25Medium

Consider the code: abstract class Animal { abstract void sound(); void sleep() { System.out.println("Zzz"); } } class Dog extends Animal { void sound() { System.out.println("Bark"); } } What can Dog objects do?

Q.26Medium

Which statement is true about the default access modifier (package-private) in Java?

Q.27Medium

What is the output of the following code? class Parent { void show() { System.out.println("Parent"); } } class Child extends Parent { void show() { System.out.println("Child"); } } public class Test { public static void main(String[] args) { Parent p = new Child(); p.show(); } }

Q.28Medium

Which of the following statements about the 'final' keyword is correct?

Q.29Medium

What is the difference between 'this' and 'super' keywords?

Q.30Medium

Consider a scenario where class B extends class A. If class A has a constructor with parameters, what must class B do?

Q.31Medium

What is the relationship between an abstract class and an interface in Java 8+?

Q.32Medium

Which of the following is true about interface default methods?

Q.33Medium

Which of the following correctly demonstrates composition over inheritance?

Q.34Medium

Which of the following demonstrates proper method overloading in Java?

Q.35Medium

What will happen if you try to override a final method in a subclass?

Q.36Medium

In Java, which of the following is true about abstract classes?

Q.37Medium

What is the correct way to call a parent class constructor from a child class?

Q.38Medium

Which statement about Java interfaces is INCORRECT according to 2024 specifications?

Q.39Medium

Consider a class hierarchy: Animal -> Dog -> Puppy. A Puppy reference can access which of the following?

Q.40Medium

What is the output of this code? class Test { static int x = 10; public static void main(String[] args) { System.out.println(x++); } }