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.41Medium

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?

Q.42Medium

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?

Q.43Medium

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); } }

Q.44Medium

Which of the following statements about 'this' keyword in Java is INCORRECT?

Q.45Medium

In Java, a class can implement multiple interfaces but can extend only one class. This design choice primarily supports which principle?

Q.46Medium

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?