Skip to content

Java OOP Practice (Interactive)

Intuition

Learning through practice: Practice problems are like training drills — they help you apply knowledge and identify areas that need more study.

Why it matters: Regular practice builds confidence and reveals patterns in how concepts are tested. Each problem reinforces key programming concepts.

The key insight: Making mistakes during practice is valuable — each error points to a concept that needs clarification.

Java — OOP Practice

8 auto-graded practice problems covering Java OOP concepts. Select an answer, submit, and review the explanation.


Classes


Interfaces


Generics


Collections


Interfaces and Abstract Classes


Enums


Records and Sealed Classes


Enums and Records


Inheritance and Polymorphism

Cross-References

Common Mistakes

Forgetting that arrays use .length not .length(): Arrays have a length field; strings have a length() method. Mixing them up causes compile errors.

Using List<Object> when you need List<?>: List<Object> allows adding any object; List<?> is read-only for any specific type. Using the wrong one causes type safety issues.

Confusing extends with implements in generics: T extends Number is an upper bound (class or interface); T implements Comparable is not valid. Use extends for both classes and interfaces in generic bounds.