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
In Java, if a parent class has a method void display() and a child class overrides it as void display(int x), what is this called?
Consider a scenario where you have an interface Shape with a method calculateArea(). You implement this in classes Circle and Rectangle. Which OOP concept is being demonstrated?
What will be printed when this code executes? class A { int x = 5; } class B extends A { int x = 10; } public class Test { public static void main(String[] args) { A a = new B(); System.out.println(a.x); } }
Which of the following statements about 'this' keyword in Java is INCORRECT?
In Java, a class can implement multiple interfaces but can extend only one class. This design choice primarily supports which principle?
In Java, when you override a method from a parent class, which of the following is NOT a valid reason to use the @Override annotation?