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
Which of the following is NOT a pillar of Object-Oriented Programming?
Which access modifier allows a member to be accessed only within the same package?
What will be the output? class Parent { void show() { System.out.println("Parent"); } } class Child extends Parent { void show() { System.out.println("Child"); } } parent obj = new Child(); obj.show();
What is the purpose of the 'super' keyword in Java?
Which interface in Java represents a collection that does not allow duplicate elements?
Which of the following correctly describes the 'this' keyword?
Which keyword is used to make a variable immutable in Java?
Which of the following access modifiers allows a variable to be accessed only within the same class?
In Java, which keyword is used to create a reference variable that cannot point to a different object after initialization?
What is the primary purpose of using the 'super' keyword in Java?
In Java OOP, which principle ensures that internal details of a class are hidden from the outside world?
Which of the following correctly describes the relationship between a class and an interface?
What will be the output of the following code? class Parent { void display() { System.out.println("Parent"); } } class Child extends Parent { void display() { System.out.println("Child"); } } public class Test { public static void main(String[] args) { Parent p = new Child(); p.display(); } }
What is the primary purpose of the 'super' keyword in Java?
Consider the code: class A { A() { System.out.println("A"); } } class B extends A { B() { super(); System.out.println("B"); } } What will be printed when 'new B()' is executed?
Which access modifier allows a member to be accessed only within the same class?
Which concept best describes the relationship between Parent and Child classes in 'class Child extends Parent'?
Which of the following correctly describes encapsulation?
What happens when you try to instantiate an interface in Java?
Which keyword is used to achieve runtime polymorphism in Java?