Repository with simple Java examples focused on understanding how the language works in practice.
The goal is to explore common pitfalls, internal behavior and best practices used in real-world scenarios.
- String comparison (
==vs.equals()) - Primitive vs Wrapper types
- Null handling
- Pass-by-value behavior
- String Pool and immutability
- Static vs instance context
- Arrays vs Collections
- Day 1 - String Comparison
- Day 2 - int vs Integer
- Day 3 - NullPointerException
- Day 4 - Pass by Value
- Day 5 - String Immutability
- Day 6 - Static vs Instance
- Day 7 - Arrays vs ArrayList
- Day 8 - equals() vs hashCode()
- Day 9 - Exception Handling
javac src/StringComparison.java
java -cp src StringComparison
Practice Java daily by writing small examples that:
- Improve logic and understanding
- Reinforce core concepts
- Simulate real interview topics
- String Comparison —
==vs.equals() - int vs Integer — primitive vs wrapper behavior
- NullPointerException — null reference behavior
- Pass by Value — how Java handles method parameters
- String Immutability — how Strings behave internally
- Static vs Instance — shared class members vs object members
- Arrays vs ArrayList — fixed-size vs dynamic collections
- equals() vs hashCode() — object comparison and hash collections
- Exception Handling — try, catch and finally behavior
📄 See /docs for detailed explanations