☕ Java Foundations
12 Java concepts, each explained step by step with real code, a common trap and practice questions.
- What Java isA compiled, statically typed, object-oriented language that runs on the JVM: write once, run anywhere.
- JDK vs JRE vs JVMJDK = tools to build (javac, jshell…), JRE = runtime libraries, JVM = the engine that executes bytecode.
- Source → bytecode → JVMjavac compiles .java to .class bytecode; the JVM loads, verifies, interprets and JIT-compiles it.
- Anatomy of a programClasses, the main method signature, braces, statements and semicolons.
- Printing outputSystem.out.println vs print vs printf, and System.err.
- CommentsLine //, block /* */ and Javadoc /** */ comments.
- Identifiers & naming conventionsLegal names, case sensitivity, camelCase, PascalCase, UPPER_SNAKE_CASE.
- Keywords & reserved wordsReserved keywords, contextual keywords (var, record, yield, sealed) and literals true/false/null.
- Compile vs runtime errorsSyntax/type errors caught by javac vs exceptions thrown while running.
- Running Javajavac + java, single-file source launch, and the jshell REPL.
- Compact source filesJava 25 instance main methods: void main() { ... } without a class declaration for small programs.
- Java editions & releasesJava SE, the 6-month release cadence, LTS versions (8, 11, 17, 21, 25) and preview features.