Java SE 8 Programmer I (OCAJP 8) key terms
Java SE 8 Programmer I (OCAJP 8) · Get comfortable with the vocabulary.
- primitive type
- Related: wrapper class, autoboxing
One of Java's eight built-in non-object types (boolean, byte, short, int, long, char, float, double) that stores a raw value directly, is never null, and cannot have methods called on it.
- wrapper class
- Related: autoboxing, primitive type
An object type such as Integer, Double, Character, or Boolean that boxes a primitive value so it can be stored in collections, be null, and be used where an object is required.
- autoboxing
- Related: wrapper class, null pointer exception
The compiler's automatic conversion of a primitive to its matching wrapper type, and the reverse unboxing, when an assignment or method call requires the other form.
- numeric promotion
- Related: cast, primitive type
Automatic widening of operands in an expression to a common type (for example byte and int become int) before the operation is performed, which can change the result's type.
- cast
- Related: numeric promotion, class cast exception
An explicit type conversion written in parentheses, needed to narrow a wider primitive into a smaller one or to treat a reference as a more specific type, with possible truncation or runtime failure.
- local variable
- Related: instance variable, scope
A variable declared inside a method, constructor, or block. It has no default value, must be assigned before use, and lives only while that block executes.
- instance variable
- Related: static variable, default value
A non-static field declared in a class body. Each object gets its own copy, and it receives a default value (0, false, or null) if not explicitly initialized.
- static variable
- Related: instance variable, static method
A field declared with the static modifier. Exactly one copy exists per class, it is shared by all instances, and it is initialized when the class is first loaded.
- default value
- Related: instance variable, local variable
The value Java assigns automatically to fields that are not initialized: zero for numeric primitives, false for boolean, '\u0000' for char, and null for object references. Local variables get none.
- scope
- Related: local variable, shadowing
The region of a program where a declared name can be referenced. It typically extends from the declaration to the end of the enclosing block, and inner blocks may shadow outer names.
- shadowing
- Related: scope, this keyword
Declaring a variable or parameter whose name matches one in an enclosing scope or a field, so the inner declaration hides the outer one inside its own scope.
- this keyword
- Related: shadowing, constructor
A reference inside an instance method or constructor that points to the current object, used to reach hidden fields, call another constructor, or pass the object itself.
- constructor
- Related: this keyword, default constructor
A special member with the class name and no return type that initializes a new object. If no constructor is declared, the compiler supplies a no-argument one.
- default constructor
- Related: constructor, super keyword
The no-argument constructor the compiler inserts only when a class declares no constructor at all; it takes no parameters and simply calls the superclass no-argument constructor.
- encapsulation
- Related: access modifier, getter
Hiding a class's internal fields behind private access and exposing controlled behavior through public methods, so callers cannot corrupt state and implementation can change freely.
- access modifier
- Related: encapsulation, protected
A keyword (private, package-private by default, protected, or public) that controls which other classes may see a class, field, method, or constructor.
- protected
- Related: access modifier, inheritance
An access level allowing access from the same package and from subclasses in any package, but only through inheritance or a reference of the subclass type.
- inheritance
- Related: super keyword, method overriding
The mechanism where a class extends another and reuses its accessible fields and methods, forming an is-a relationship; Java permits a single superclass but multiple interface implementation.
- super keyword
- Related: inheritance, constructor
A reference used inside a subclass to call the superclass constructor, invoke an overridden superclass method, or reach a hidden superclass field.
- method overriding
- Related: polymorphism, method overloading
Redefining an inherited instance method in a subclass with the same signature. The subclass version is chosen at runtime, and the return type may be covariant.
- method overloading
- Related: method overriding, polymorphism
Declaring several methods with the same name but different parameter lists in one class. The compiler selects one at compile time based on argument types.
- polymorphism
- Related: method overriding, class cast exception
The ability of a superclass or interface reference to refer to objects of different subtypes, with the actual overridden method chosen at runtime.
- abstract class
- Related: interface, inheritance
A class declared abstract that cannot be instantiated and may declare abstract methods without bodies, which concrete subclasses must implement.
- interface
- Related: abstract class, default method
A contract declaring abstract methods (and, since Java 8, default and static methods) that implementing classes must fulfill; a class may implement many interfaces.
- default method
- Related: interface, method overriding
A method in an interface declared with the default keyword that supplies a body, so implementing classes inherit it without being forced to override it.
- class cast exception
- Related: cast, instanceof operator
A runtime exception thrown when an explicit downcast to a type the object is not actually an instance of is executed.
- instanceof operator
- Related: class cast exception, cast
A boolean operator that tests whether a reference is non-null and refers to an object compatible with a given type, often used to guard a downcast.
- checked exception
- Related: unchecked exception, try catch finally
An exception that is not a RuntimeException or Error and that the compiler requires to be caught or declared with throws in the method signature.
- unchecked exception
- Related: checked exception, null pointer exception
A RuntimeException or Error subclass that the compiler does not force you to catch or declare, such as NullPointerException or IllegalArgumentException.
- try catch finally
- Related: checked exception, try with resources
The construct that runs guarded code in try, handles matching exceptions in catch blocks, and always runs finally, even when an exception escapes or a return occurs.
- try with resources
- Related: try catch finally, checked exception
A try statement declaring one or more AutoCloseable resources in parentheses, which are closed automatically in reverse order when the block finishes.
- null pointer exception
- Related: unchecked exception, autoboxing
A runtime exception thrown when code invokes a method or accesses a field through a reference that holds null.
- switch statement
- Related: break statement, ternary operator
A multi-branch construct comparing an expression against case labels of int-compatible types, enums, or String; execution falls through unless break or return is used.
- ternary operator
- Related: switch statement, short circuit
The only three-operand operator, written condition ? valueIfTrue : valueIfFalse, which evaluates to one of two values based on a boolean test.
- short circuit
- Related: ternary operator, numeric promotion
Behavior of && and || where the right operand is skipped when the left already determines the result; single & and | always evaluate both sides.
- break statement
- Related: continue statement, switch statement
A statement that exits the nearest enclosing loop or switch immediately; with an optional label it exits the labeled outer statement.
- continue statement
- Related: break statement, for loop
A statement that skips the rest of the current loop iteration and proceeds to the next one, honoring any label to target an outer loop.
- for loop
- Related: while loop, continue statement
A loop with initialization, boolean condition, and update sections, or the enhanced form that iterates over arrays and Iterable collections.
- while loop
- Related: do while loop, for loop
A loop that tests a boolean condition before each iteration and repeats its body while the condition remains true, executing zero or more times.
- do while loop
- Related: while loop, for loop
A loop that runs its body first and then tests the condition, so the body always executes at least once.
- array
- Related: array index exception, multidimensional array
A fixed-length container of same-typed values created with new or an initializer, indexed from zero, whose length is exposed as a final field.
- multidimensional array
- Related: array, array index exception
An array whose elements are themselves arrays, such as int[][], which need not be rectangular because each nested array can have a different length.
- array index exception
- Related: array, null pointer exception
The runtime exception (ArrayIndexOutOfBoundsException) thrown when an array is accessed with an index below zero or at least its length.
- String immutability
- Related: StringBuilder, string pool
The property that a String's character content never changes after creation; methods like trim or replace return a new String instead of modifying the original.
- StringBuilder
- Related: String immutability, String pool
A mutable sequence of characters offering append, insert, and reverse operations that change the same object, commonly used to build strings efficiently.
- string pool
- Related: String immutability, equals method
A cache of string literals in memory; identical literals share one object, while strings made with new String always create a distinct object.
- equals method
- Related: string pool, wrapper class
The method used to compare logical content. Object's version compares references, so classes like String and wrapper types override it to compare values.
- ArrayList
- Related: autoboxing, wrapper class
A resizable-array implementation of List that grows automatically, supports index access, and stores objects rather than primitives.
- immutable date-time class
- Related: String immutability, StringBuilder
A java.time type such as LocalDate or LocalDateTime whose 'with' and 'plus' methods return a new instance instead of changing the original.
- main method
- Related: static method, varargs
The entry point with the exact signature public static void main(String[] args), which the JVM invokes to start a standalone application.
- static method
- Related: static variable, main method
A method declared with static that belongs to the class, not an object, so it is called through the class name and cannot use this or instance fields directly.
- varargs
- Related: array, main method
A parameter written with three dots, such as String... names, that accepts zero or more arguments and is received inside the method as an array.
- getter
- Related: encapsulation, access modifier
A public method, conventionally named getX or isX, that returns the value of a private field, often the read half of an encapsulated property.
- package declaration
- Related: import statement, access modifier
The optional first statement naming a class's package, which must precede imports and determines the class's fully qualified name and default package-private access.
- import statement
- Related: package declaration, access modifier
A declaration that lets code use simple names from another package; a single-type import names one class, while a wildcard import covers a whole package but not its subpackages.