Java OOP Concepts

Coding

Test yourself on some important Java OOP concepts!

150 XP
Reward
15
Questions
5–10 min
Time
Q1 Question 1 of 15

Which is an example of runtime polymorphism?

Q2 Question 2 of 15

What happens if a subclass defines a method with the same name, parameters, but a different return type as its superclass?

Q3 Question 3 of 15

Which of the following best describes encapsulation in Java?

Q4 Question 4 of 15

Which statement about abstract classes and interfaces is true?

Q5 Question 5 of 15

Can constructors be inherited in Java?

Q6 Question 6 of 15

Which of the following is true about method overloading and overriding?

Q7 Question 7 of 15

What does the super keyword refer to in Java?

Q8 Question 8 of 15

Which of these uses of final is incorrect?

Q9 Question 9 of 15

What happens if a static method tries to access a non-static variable directly?

Q10 Question 10 of 15

Can you create an object of an abstract class?

Q11 Question 11 of 15

If two interfaces have the same default method name and a class implements both, what must be done?

Q12 Question 12 of 15

Which of the following is not a commonly overridden method from the Object class?

Q13 Question 13 of 15

Why might composition be preferred over inheritance?

Q14 Question 14 of 15

Which access modifier allows visibility only within the same package?

Q15 Question 15 of 15

How does Java decide which overridden method to call when a superclass reference points to a subclass object?