Java Fundamentals 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 — Fundamentals Practice
10 auto-graded practice problems covering Java fundamentals. Select an answer, submit, and review the explanation.
Types and Variables
Access Modifiers
Collections
Streams
Concurrency
Generics
Garbage Collection
JIT Optimization (Hard)
Class Loading Order (Hard)
Cross-References
- Java Fundamentals Flashcards: Interactive flashcards covering the same core Java concepts tested here.
- Types and Variables: Type system fundamentals tested in the types section.
- Control Flow: Exception handling and switch expressions.
Common Mistakes
Forgetting that b + 1 promotes to int: Byte arithmetic automatically widens to int. Assigning back to byte requires an explicit cast. Use b += 1 for implicit casting.
Confusing volatile with synchronization: volatile ensures visibility but not atomicity. count++ is not atomic even with volatile. Use synchronized or AtomicInteger for compound operations.
Using == to compare strings: == compares object identity, not content. Use .equals() or .compareTo() for string comparison.