Java foundamental: quick revision, 16 bites
All 16 revision bites from this kit, free and with no sign-up.
Java's Core Promise: Write Once, Run Anywhere
Platform independence is the key.
Java source code (`.java` files) is compiled by the **javac** compiler into **bytecode** (`.class` files). This bytecode runs on the **Java Virtual Machine (JVM)**, which is platform-specific but makes Java programs portable across any system with a JVM installed.
Takeaway. Java achieves portability by compiling to bytecode, executed by the JVM.
JVM, JRE, JDK — The Three Layers
Know the difference to save time.
Takeaway. JDK is for development; JRE is for running; JVM is the engine inside both.
Main Method — The Entry Point
Every Java app starts here.
The JVM looks for this exact signature to begin execution. `public` makes it accessible; `static` allows calling without an object; `void` returns nothing; `String[] args` holds command-line arguments.
Takeaway. The `main` method is the mandatory starting point for any standalone Java application.
Primitive Data Types — The Building Blocks
Eight types, not more.
Takeaway. Java has exactly 8 primitive types; everything else is an object.
Integer Division Gotcha
Dividing ints? Expect truncation.
Takeaway. Integer division truncates; use at least one floating-point operand for fractional results.
Reference vs. Primitive — Memory Matters
Primitives store values; references store addresses.
Takeaway. Primitives hold actual data; reference variables point to objects in heap memory.
String — Not a Primitive, But Special
Strings are objects, but with shortcuts.
`String` is a class, not a primitive. You can create strings with `new String("hello")` or directly with literals like `"hello"`. Java's **string pool** reuses literal strings to save memory.
Takeaway. Use `.equals()` for string content comparison, not `==`.
Compilation and Execution Flow
From source to output in two steps.
Takeaway. Compile once (`javac`), run anywhere (`java`).
Java is Statically Typed
Types are checked at compile time.
Every variable must be declared with a type before use. This catches type errors early, making Java more robust but requiring more explicit code than dynamically typed languages like Python.
Takeaway. Static typing means fewer runtime surprises, but more upfront declarations.
Naming Conventions — Readable Code
Follow the camelCase pattern.
Takeaway. Consistent naming makes code self-documenting and easier to maintain.
Use `final` for Constants
Lock values that shouldn't change.
Declare a variable as `final` to make it a constant — its value cannot be reassigned. This prevents accidental changes and communicates intent.
Takeaway. Use `final` for values that should remain fixed throughout execution.
Shortcut: `var` for Local Variables (Java 10+)
Let the compiler infer the type.
Use `var` to declare local variables when the type is obvious from the initializer. This reduces boilerplate without losing static typing.
Takeaway. `var` saves keystrokes while preserving type safety — use it for local variables with clear initializers.
Class = Blueprint, Object = House
One blueprint, many houses.
A **class** defines the structure and behavior (like a blueprint for a house). An **object** is a concrete instance built from that blueprint. You can create many objects from one class, each with its own state.
Takeaway. Classes define the template; objects are the actual runtime entities.
Access Modifiers — Controlling Visibility
Who can see what?
Takeaway. Use the most restrictive access modifier that still allows needed visibility — prefer `private` by default.
Simple Console I/O — Reading User Input
Get input from the keyboard quickly.
Takeaway. Use `Scanner` with `System.in` for easy console input; always close the scanner to free resources.
Java Powers Android Apps
Your phone runs Java bytecode.
Android apps are primarily written in Java (or Kotlin, which runs on the JVM). The Android SDK compiles Java code into DEX bytecode, executed by the Android Runtime (ART). Understanding Java fundamentals is the first step to building mobile apps.
Takeaway. Java's portability extends to mobile — it's the backbone of Android development.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages