How Tos, Reference, Examples & Interview Path
Read file: Files.readString(path). Write file: Files.writeString(path, text). Sort list: Collections.sort(list).
How Tos — common tasks quick guide
Read file: Files.readString(path). Write file: Files.writeString(path, text). Sort list: Collections.sort(list).
Parse int safely: Integer.parseInt in try-catch. Compare strings: equals(), not ==.
Real-life example: How Tos are recipe cards on the fridge — fastest way to make chai without opening the full cookbook.
- Compare strings with .equals()
- Use try-with-resources for files
- Prefer ArrayList and HashMap by default
- Check null before calling methods
Reference notes — keep handy
Official docs: docs.oracle.com/javase. Use the official Java API docs for quick lookup.
Main method signature: public static void main(String[] args). Package first line, then imports, then class.
Real-life example: Reference is a dictionary — you do not memorize every word, but you know where to look.
Examples & Interview path
Interview topics: OOP pillars, equals vs ==, String immutability, ArrayList vs LinkedList, HashMap internals basics, exception types, multithreading intro.
Practice coding: reverse string, find duplicates, two-sum, fibonacci, singleton pattern basics.
Real-life example: Interview path is exam prep — revise notes (this course), solve past papers (LeetCode easy), mock interview with friend.
- Core: OOP, collections, exceptions
- Medium: threads, generics, streams intro
- Practice: 20 easy Java programs from scratch
- Next course: Spring Boot on Rishtaara