Java Tutorial · Revision notes
Java MCQ
A focused practice chapter with multiple-choice questions on Java basics, object-oriented programming and common interview topics. Each section lists the facts the questions test and a runnable program that proves the tricky answers.
Quick revision
- Basics: left-to-right +, overflow wraps, integer cache -128..127, Math.round(-2.5) = -2
- OOP: overloading = compile time; overriding = run time; fields/statics by reference type
- Abstract class: constructors allowed, no instances; interface fields are public static final
- Java is pass-by-value; equals and hashCode go together
- final vs finally vs finalize; HashMap one null key; StringBuffer thread-safe
- Heap = objects; stack = frames; StackOverflowError = deep recursion