Quick Revision & One-Page Cheat Sheets
Module-wise revision sheets, Java keywords, syntax templates, comparison tables, memory tricks, and your personal saved study bookmarks.
Click “Bookmark” inside any topic note to save high-value topics here for fast revision.
Use “Flag Difficult” on challenging topics so you can revisit them right before the exam.
How Java achieves WORA via bytecode + JVM, core data types/wrappers/arrays/strings/Vector/operators/control flow, OOP 4 pillars + Microservices, and building objects with constructors & this.
Must-Know Definitions
.class intermediate instructions runnable unchanged on any OS possessing a JVM.javac); JRE = JVM + Runtime libraries; JVM = Virtual bytecode execution engine.int) and Wrapper objects (Integer).Important Java Keywords & Syntax
staticstatic int count;Class-level single copy in Method Area; callable without new.
thisthis.x = x; this(10);Refers to current object; resolves shadowing or chains same-class constructors.
abstractabstract class Shape {}Incomplete blueprint preventing instantiation.
instanceofobj instanceof StudentTests object runtime class compatibility.
...void sum(int... v)Varargs parameter (compiled as array; must be last param).
| public class Student { |
| String name; |
| Student() { this("Unknown"); } |
| Student(String name) { this.name = name; } |
| } |
| Criterion | Procedural (C) | OOP (Java) |
|---|---|---|
| Focus | Functions / Procedures | Objects (Data + Methods) |
| Approach | Top-down | Bottom-up |
| Security | Global open data | Hidden private data (Encapsulation) |
- JVM 5 Memory Areas: '2 Shared, 3 Per-Thread': Shared = Method + Heap | Thread = JVM Stack + PC + Native Stack.
- Widening Order: 'B-S-I-L-F-D': byte -> short -> int -> long -> float -> double.
- OOP 4 Pillars: 'A-P-I-E': Abstraction, Polymorphism, Inheritance, Encapsulation.
- Draw JVM Architecture (Class Loader -> 5 Runtime Areas -> Execution Engine + JNI).
- Know all 8 primitives + byte/short promotion to
intin expressions. - Know String immutability (
==vs.equals()) + Vector (Objectsonly). - Know
>>>vs>>and&&vs&. - Know 6 Microservices characteristics + Monolith vs Microservices.
- Know all 6 uses of
thisand constructor rules.
Revise JVM, Inheritance, Exception Tree, MVC, Delegation Model & JDBC diagrams.
Memorize Overloading vs Overriding, Interface vs Abstract, Access Matrix & 4 JDBC Drivers.
Practice Bad vs Good SOLID Java code, Singleton, Adapter & Microservices characteristics.
Trace constructor order (`super()`), `try-catch-finally`, dynamic dispatch & custom exceptions.
Complete Exam Definitions Glossary (134)
A high-level, class-based, object-oriented, strongly typed programming language and software runtime platform developed at Sun Microsystems (led by James Gosling).
Java's portability guarantee: source code compiled once into platform-independent bytecode (.class) executes unchanged on any operating system or processor equipped with a compatible JVM.
Standardized capitalization and identifier rules (PascalCase for classes/interfaces, camelCase for methods/variables, UPPER_SNAKE_CASE for constants, lowercase dot-separated names for packages) that keep code readable and compliant with KTU standards.
Complete software package needed to develop, compile, debug, and run Java applications. Contains the JRE plus development tools (javac, javap, javadoc, jdb).
Software package containing the JVM, standard class libraries, and supporting runtime files needed solely to execute compiled Java programs (contains java, not javac).
javac)M1Command-line tool in JDK that checks .java source files for syntax, semantic, and type errors and translates valid source into .class bytecode.
PATH tells the OS shell where JDK executables (javac, java) reside; CLASSPATH tells javac and the JVM where user-defined .class files and third-party .jar libraries are located.
JVM subsystem responsible for dynamically Loading .class files, Linking (Bytecode Verification, Preparation of static memory, Resolution of symbolic references), and Initializing static variables/blocks.
Component of the JVM Execution Engine that boosts performance by compiling frequently executed bytecode ('hot spots') directly into native CPU machine code at runtime.
Automatic background memory manager inside the JVM Execution Engine that identifies and reclaims Heap objects no longer referenced by any live variable.
One of Java's 8 built-in non-object value types (byte, short, int, long, float, double, char, boolean) whose size and range are fixed across all platforms.
A fixed constant value written directly in source code, belonging to one of 6 categories: integer (100, 0x1F, 012), floating-point (3.14f, 1.2e5), boolean (true, false), character ('A', '\u0064'), string ("KTU"), or null (for references only).
Condition where an arithmetic result exceeds the maximum (Overflow) or drops below the minimum (Underflow) range of an integer type, causing silent two's-complement wrap-around without throwing an exception.
Automatic conversion of a smaller compatible primitive type into a larger type (byte -> short -> int -> long -> float -> double, and char -> int) without data loss.
Manual conversion of a larger type to a smaller type ((targetType) value) required when precision or range may be lost (truncation).
One of 8 classes in java.lang (Byte, Short, Integer, Long, Float, Double, Character, Boolean) that encapsulates a primitive value into an immutable object.
Compile-time automatic conversion performed by javac between a primitive type and its corresponding wrapper class (int <-> Integer).
A fixed-length, indexed data structure (treated as a reference object in Java) that stores homogeneous elements in contiguous logical order starting at index 0.
A multidimensional array in Java where individual rows are allocated independently with varying column lengths (e.g., row 0 has 2 elements, row 1 has 4 elements).
A final, immutable class representing a sequence of characters. String literals are stored in a shared Heap memory region called the String Constant Pool.
Design property where a String object's character sequence cannot be modified after creation; operations like replace() or concat() return a newly created String object.
A legacy, synchronized dynamic array class in java.util capable of growing/shrinking at runtime and storing heterogeneous or generic object references.
Priority hierarchy determining which operator executes first in an expression containing multiple operators of differing priority (e.g., * before +).
Evaluation direction (Left-to-Right or Right-to-Left) used when adjacent operators share the exact same precedence level (e.g., 6 / 2 * 3 evaluates (6 / 2) * 3 = 9 Left-to-Right; a = b = 5 evaluates a = (b = 5) Right-to-Left).
>>>)M1Java-specific bitwise shift operator that shifts bits right and ALWAYS fills vacated leftmost bits with 0 (unlike signed >>, which preserves the sign bit).
if, switch)M1Control structures that route execution along distinct branches depending on a boolean condition (if) or equality match against constants (switch).
for-each LoopM1Iteration syntax for (type var : collection) (introduced in Java 5) that sequentially traverses arrays and collections using a read-only iteration variable.
breakM1A civilized replacement for goto in Java (break labelName;) used to break directly out of nested outer loops or labeled blocks.
A named block of code declared inside a class that defines an object's behavior, accepting zero or more parameters and optionally returning a value.
Space-separated tokens passed immediately after the class name when launching a program (java MyApp arg1 arg2), stored automatically as Strings in main(String[] args).
A method parameter declared with ellipsis (type... name) enabling the method to receive zero or more arguments of that type, treated internally as a standard array.
A user-defined blueprint or template that groups state (fields/variables) and behavior (methods/constructors) common to a set of objects.
A class declared with the abstract modifier that cannot be directly instantiated (new), designed to share common fields/methods while optionally leaving abstract methods (without body) for subclasses to implement.
A reference type declared with interface specifying what a class must do (contract of abstract methods + constants) rather than how it does it; a single class can implement multiple interfaces.
A programming paradigm that models software as a collection of interacting objects, where each object combines internal data (attributes) and allowed operations (methods).
A top-down paradigm (e.g., C, Pascal) focused on step-by-step procedures/functions operating on separate data structures, often exposing data globally.
A class satisfies both requirements of an ADT: (1) it is a Data Type defining a set of values and operations that can be instantiated into objects, and (2) its internal data representation is Abstracted (hidden) behind methods.
Mechanism of exposing only relevant functionality to the user while suppressing internal implementation details. Includes Data Abstraction (hiding how an object stores private data) and Feature Abstraction (inheritance hierarchies retaining common traits).
Mechanism of wrapping data (variables) and the code manipulating it (methods) into a single unit (class), restricting direct external access to prevent misuse.
Mechanism whereby a subclass acquires the attributes and behaviors of an existing superclass, supporting hierarchical classification and code reusability.
Greek for 'many forms'; ability of an entity or method call (one interface, multiple methods) to exhibit different behaviors depending on parameter types (static/compile-time) or actual runtime object type (dynamic/run-time).
Traditional software architecture where all UI, business logic, and data access components are tightly compiled and deployed together as a single unified codebase/artifact.
Architectural style that structures an application as a collection of small, autonomous, loosely coupled services modeled around distinct business domains, each owning its own data and communicating via lightweight network APIs.
A runtime instance of a class possessing three characteristics: State (field values), Behavior (methods), and Identity (unique runtime existence/memory reference).
A variable of a class type (e.g., Student s1) that holds the memory reference (address handle) of an object on the Heap, or null if pointing to nothing.
new OperatorM1Operator that dynamically allocates Heap memory for an object at runtime, initializes default field values, executes the class constructor, and returns the object's reference.
A special member block inside a class with the exact same name as the class and no explicit return type, automatically invoked by new to initialize a newly created object.
A Default Constructor is automatically inserted by javac with an empty body ONLY if you define ZERO constructors. A No-Arg Constructor is explicitly written by the programmer with ClassName() { ... }.
Defining multiple constructors within the same class having distinct parameter lists (different number, data types, or order of parameters) to allow flexible object initialization.
Keywords (public, private, protected, or omitted default/package-private) controlling visibility of classes, constructors, fields, and methods across classes and packages.
this KeywordM1An implicit reference variable inside instance methods and constructors that refers to the current object on which the method or constructor was invoked.
OOP ability of an interface or method name to take multiple forms ('one interface, multiple methods'), resolved either statically at compile time or dynamically at runtime.
Polymorphism resolved entirely by javac during compilation based on method signatures and argument types (e.g., Method Overloading and Constructor Overloading).
Defining two or more methods within the same class (or inherited hierarchy) sharing the same name but possessing different parameter lists (number, type, or sequence of parameters).
Passing a class-type reference into a method or constructor (e.g., boolean equalTo(Test o) or copy constructor Box(Box ob)).
Java passes a copy of every argument onto the callee's stack frame. For primitives, changes never affect the caller; for objects, the copied reference still points to the caller's Heap object, allowing field mutation (often casually described in older textbooks as behaving like call-by-reference for object state).
The process of defining a solution in terms of itself; a Java method that invokes itself directly or indirectly is called a recursive method.
An if condition inside a recursive method that returns directly without making further recursive calls, stopping infinite recursion.
A field declared with static outside methods; allocated once in the Method Area at class-loading time and shared across all instances of the class.
A method declared with static that belongs to the class itself (ClassName.method()), callable without creating an object. Cannot access non-static members directly or use this/super.
A static { ... } initializer block executed automatically once when the class is first loaded into JVM memory—prior to main() and any object creation.
A variable marked final whose value cannot be reassigned once initialized (Java's named constant). Combined with static, forms a class constant (static final).
A class declared within the body of another class (or method). Non-static nested classes are termed Inner Classes; static ones are termed Static Nested Classes.
A nameless local class declared and instantiated in a single expression (new Interface() { ... };), widely used in Swing/event handling and threads.
A general class whose common attributes and methods are inherited by one or more derived classes.
A specialized class declared with extends SuperClass that inherits accessible members of the superclass and adds or overrides specialized members.
Ambiguity arising when a subclass inherits from two superclasses that both inherit from a common ancestor or define conflicting implementations of the same method (show()).
super KeywordM2A reference keyword inside a subclass pointing to its immediate superclass, used to invoke superclass constructors (super(args)) and access hidden superclass fields or overridden methods (super.member).
protected Access ModifierM2Visibility level granting access to the declaring class, all classes in the same package, AND all subclasses—even if those subclasses live in DIFFERENT packages.
Automatic or explicit invocation of superclass constructors from every subclass constructor via super(...), ensuring base layers are fully initialized before derived layers execute.
Defining a method in a subclass with the exact same name, parameter signature, and compatible (same or covariant) return type as a method in its superclass, replacing the superclass implementation for subclass objects.
Runtime polymorphism mechanism whereby a call to an overridden method through a superclass reference variable is resolved by the JVM at runtime based on the actual object type being referenced.
final MethodM2A method declared with the final modifier (final void verify()) that CANNOT be overridden by any subclass, ensuring consistent behavior and allowing early binding optimization.
final ClassM2A class declared with the final modifier (final class SecurityGate) that CANNOT be inherited (subclassed) by any other class; all its methods are implicitly final.
A namespace container for grouping related classes, interfaces, and sub-packages hierarchically, serving as both a naming mechanism (preventing collisions) and a visibility-control mechanism.
The anonymous package assigned automatically when a Java source file omits the package declaration; recommended only for small test programs.
An OS environment variable or -cp / -classpath CLI flag telling javac and the JVM which root directories and .jar/.zip archives to search for user-defined classes and third-party libraries.
import StatementM3Directive placed immediately after package and before class declarations (import pkg.ClassName; or import pkg.*;) bringing external packaged classes into unqualified scope.
default) AccessM3Access level applied automatically when no modifier (public, private, protected) is written; restricts visibility strictly to classes inside the same package.
A reference type declared with interface defining abstract method contracts, constants (public static final), and (since JDK 8) optional default/static methods, enabling unrelated classes to share polymorphic behavior.
A class that implements an interface without implementing all of its abstract methods; Java requires such a class to be declared abstract.
An interface declared as a member inside a class or another interface; unlike top-level interfaces (public or default), nested interfaces inside a class can be public, private, or protected.
extends)M3Mechanism where one interface inherits constants and method declarations from one or more parent interfaces (interface B extends A1, A2).
default MethodM3A concrete method defined inside an interface using the default keyword (default void log() { ... }), allowing libraries to add new interface methods without breaking existing implementing classes.
An abnormal event/condition arising during program execution (runtime) that disrupts normal sequential instruction flow, represented in Java as an object descending from java.lang.Throwable.
An Exception subclass (EXCLUDING RuntimeException and Error) checked strictly by javac at compile time; the programmer MUST handle it with try-catch or declare it via throws (IOException, SQLException, ClassNotFoundException).
An exception descending from RuntimeException (or Error) that is NOT checked by javac at compile time, typically caused by programmer logic mistakes (ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException).
Built-in runtime fallback triggered when an exception is never caught by user code; prints the exception name/message, prints a call stack trace, and terminates the thread.
try and catch BlockM3try { ... } encloses code that may throw an exception (curly braces mandatory even for 1 statement); catch (ExType e) { ... } defines a handler immediately following try for matching exception objects.
try StatementM3A try block placed inside another try block; if an inner try lacks a matching catch, the stack unwinds outward to inspect enclosing try's catch clauses.
finally BlockM3An optional block after try/catch containing guaranteed cleanup code that executes regardless of whether an exception was thrown, caught, uncaught, or returned early.
throw KeywordM3Statement inside a method/block used to explicitly throw a single Throwable object (throw new MyException("msg"); or rethrowing a caught parameter throw e;).
throws KeywordM3Clause appended to a method declaration (void readFile() throws IOException, SQLException) listing checked exceptions the method might throw without handling internally, pushing responsibility to the caller.
Mechanism where an unhandled exception automatically travels backward (unwinds) down the runtime call stack from callee to caller until a matching catch block is found (or the default JVM handler terminates the thread).
A programmer-defined class extending Exception (for a checked custom exception) or RuntimeException (for unchecked), usually overriding/calling super(message) or toString().
A general, reusable architectural solution (template) to a commonly occurring problem in object-oriented software design, popularized by the 'Gang of Four' (GoF) across Creational, Structural, and Behavioral categories.
A Creational design pattern that guarantees a class has only ONE instance in the JVM and provides a global point of access to that single instance.
A Structural design pattern that converts the interface of an existing class (Adaptee) into another interface (Target) expected by clients, allowing classes with incompatible interfaces to collaborate without modifying their source code.
First SOLID principle stating that every class or module should have responsibility over a single part of functionality—meaning it should have only ONE reason to change.
Second SOLID principle stating that software entities (classes, modules, methods) should be open for extension (supporting new behaviors), but closed for modification (without altering existing working source code).
Introduced by Barbara Liskov: Objects of a superclass must be replaceable with objects of any of its subclasses without breaking the correctness or expected behavioral contract of the program.
Fourth SOLID principle: No client class should be forced to depend on or implement methods from an interface that it does not use; prefer multiple small cohesive interfaces over one fat monolithic interface.
Fifth SOLID principle: (1) High-level modules should not depend on low-level modules; both should depend on abstractions (interfaces). (2) Abstractions should not depend on details; details should depend on abstractions.
Java's original GUI toolkit (java.awt) whose components (Button, Label, TextField) are heavyweight, delegating rendering directly to native OS peer widgets.
A rich Java GUI framework (javax.swing) built upon AWT that provides flexible lightweight components written entirely in Java with a Pluggable Look and Feel.
A GUI widget written 100% in Java that does NOT map directly to an OS-specific native peer component, enabling consistent cross-platform behavior and lower OS resource overhead.
Swing feature allowing developers or users to dynamically change the visual appearance ('look') and interaction style ('feel')—such as Windows, Metal, Nimbus, or custom themes—at runtime without rewriting application logic.
Software architecture splitting an interactive component into three concerns: Model (application state/data), View (visual rendering), and Controller (user input handling).
Swing's adapted version of MVC that combines View and Controller into a single logical entity called the UI Delegate (ComponentUI), enabling Pluggable Look and Feel.
A Component is an independent visual control (JButton, JLabel); a Container is a specialized component capable of holding other components and nested containers (JFrame, JPanel), forming a Containment Hierarchy.
JFrameM4Primary top-level Swing container window for desktop applications (javax.swing.JFrame), implementing WindowConstants to define close behavior (EXIT_ON_CLOSE, DISPOSE_ON_CLOSE, HIDE_ON_CLOSE, DO_NOTHING_ON_CLOSE).
JLabel and ImageIconM4Passive JComponent displaying read-only text and/or an Icon (ImageIcon loaded from file/URL) aligned via SwingConstants (LEFT, RIGHT, CENTER, LEADING, TRAILING).
JTextFieldM4Single-line editable text control extending JTextComponent, backed by the Document model; fires ActionEvent on Enter and CaretEvent on cursor move.
ButtonGroupM4Four button classes extending AbstractButton (JButton, JToggleButton, JCheckBox, JRadioButton), plus ButtonGroup which enforces mutual exclusion among grouped JRadioButtons.
An object describing a state change in a source (caused by GUI user actions like button clicks/keystrokes, or non-UI triggers like timers/counters).
An object (such as JButton, JTextField, JFrame) that generates an event and dispatches it to registered listeners via addTypeListener(TypeListener el) and removeTypeListener(...).
An object implementing one or more listener interfaces (from java.awt.event or javax.swing.event) that registers with a source to receive and handle event notifications.
Multicasting notifies ALL registered listeners when an event fires (standard in Java); Unicasting allows at most one registered listener (throwing java.util.TooManyListenersException on a second registration).
java.util.EventObjectM4Root superclass of ALL event classes in Java, defining Object getSource() and toString().
java.awt.AWTEventM4Direct subclass of EventObject serving as the superclass for all AWT/Swing Delegation Event Model events (int getID()).
ActionEvent & ActionListenerM4Event fired when a JButton is pressed, a JTextField receives Enter, or a menu item is selected; handled by implementing void actionPerformed(ActionEvent ae).
An object implementing java.awt.LayoutManager assigned to a Container (setLayout(...)) that automatically computes positions and sizes of child components dynamically.
FlowLayoutM4Simple layout manager arranging components sequentially row by row in their preferred sizes, wrapping to new lines when horizontal space runs out.
BorderLayoutM4Layout manager dividing container space into five regions (NORTH, SOUTH, EAST, WEST, CENTER), allowing at most ONE component per region.
GridLayoutM4Layout manager dividing container space into an equal-sized rectangular grid of rows × cols cells.
CardLayoutM4Layout manager treating components inside a container as a stack of cards where only one named card is visible at a time (first, next, previous, last, show).
GridBagLayout & GridBagConstraintsM4Flexible grid layout manager where components occupy dynamic rectangular regions configured via a GridBagConstraints object (gridx, gridy, gridwidth, gridheight, weightx, weighty, fill, anchor).
A standard Java API (java.sql and javax.sql) defining how a Java client connects to heterogeneous relational databases, submits SQL statements, and processes returned results independently of the underlying DBMS.
In the Two-Tier model, a Java client communicates directly with the DBMS via a JDBC driver (Client -> Driver -> DB). In the Three-Tier model, the client talks to a middle-tier application server, which uses JDBC to communicate with the DBMS (Client -> App Server -> Driver -> DB).
A software component implementing java.sql.Driver that translates vendor-independent JDBC API calls into a specific database vendor's proprietary communication protocol.
DriverManager (Class) & Driver (Interface)M4DriverManager manages registered Driver implementations and matches a connection request's JDBC URL subprotocol to the first compatible driver to return a Connection.
Connection (Interface)M4Represents a live communication session (physical context) with a specific database; factory for creating Statement, PreparedStatement, and CallableStatement objects (conn.createStatement(), conn.close()).
Statement vs PreparedStatement vs CallableStatementM4Statement executes static SQL strings compiled every call; PreparedStatement (sub-interface) executes precompiled parameterized SQL with ? placeholders (prevents SQL injection & runs faster repeatedly); CallableStatement invokes database Stored Procedures.
ResultSet (Interface) & SQLException (Class)M4ResultSet holds tabular data returned by executeQuery() and acts as a cursor iterator (rs.next(), rs.getInt(), rs.getString()). SQLException is a checked exception class reporting database/SQL errors.