Java SE 8 Programmer I (OCAJP 8) study materials
Java SE 8 Programmer I (OCAJP 8) study resources

Java SE 8 Programmer I (OCAJP 8) key terms

Java SE 8 Programmer I (OCAJP 8) · Get comfortable with the vocabulary.

primitive type

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.

Related: wrapper class, autoboxing
wrapper class

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.

Related: autoboxing, primitive type
autoboxing

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.

Related: wrapper class, null pointer exception
numeric promotion

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.

Related: cast, primitive type
cast

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.

Related: numeric promotion, class cast exception
local variable

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.

Related: instance variable, scope
instance variable

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.

Related: static variable, default value
static variable

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.

Related: instance variable, static method
default value

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.

Related: instance variable, local variable
scope

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.

Related: local variable, shadowing
shadowing

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.

Related: scope, this keyword
this keyword

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.

Related: shadowing, constructor
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.

Related: this keyword, default constructor
default constructor

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.

Related: constructor, super keyword
encapsulation

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.

Related: access modifier, getter
access modifier

A keyword (private, package-private by default, protected, or public) that controls which other classes may see a class, field, method, or constructor.

Related: encapsulation, protected
protected

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.

Related: access modifier, inheritance
inheritance

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.

Related: super keyword, method overriding
super keyword

A reference used inside a subclass to call the superclass constructor, invoke an overridden superclass method, or reach a hidden superclass field.

Related: inheritance, constructor
method overriding

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.

Related: polymorphism, method overloading
method overloading

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.

Related: method overriding, polymorphism
polymorphism

The ability of a superclass or interface reference to refer to objects of different subtypes, with the actual overridden method chosen at runtime.

Related: method overriding, class cast exception
abstract class

A class declared abstract that cannot be instantiated and may declare abstract methods without bodies, which concrete subclasses must implement.

Related: interface, inheritance
interface

A contract declaring abstract methods (and, since Java 8, default and static methods) that implementing classes must fulfill; a class may implement many interfaces.

Related: abstract class, default method
default method

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.

Related: interface, method overriding
class cast exception

A runtime exception thrown when an explicit downcast to a type the object is not actually an instance of is executed.

Related: cast, instanceof operator
instanceof operator

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.

Related: class cast exception, cast
checked exception

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.

Related: unchecked exception, try catch finally
unchecked exception

A RuntimeException or Error subclass that the compiler does not force you to catch or declare, such as NullPointerException or IllegalArgumentException.

Related: checked exception, null pointer exception
try catch finally

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.

Related: checked exception, try with resources
try with resources

A try statement declaring one or more AutoCloseable resources in parentheses, which are closed automatically in reverse order when the block finishes.

Related: try catch finally, checked exception
null pointer exception

A runtime exception thrown when code invokes a method or accesses a field through a reference that holds null.

Related: unchecked exception, autoboxing
switch statement

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.

Related: break statement, ternary operator
ternary operator

The only three-operand operator, written condition ? valueIfTrue : valueIfFalse, which evaluates to one of two values based on a boolean test.

Related: switch statement, short circuit
short circuit

Behavior of && and || where the right operand is skipped when the left already determines the result; single & and | always evaluate both sides.

Related: ternary operator, numeric promotion
break statement

A statement that exits the nearest enclosing loop or switch immediately; with an optional label it exits the labeled outer statement.

Related: continue statement, switch statement
continue statement

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.

Related: break statement, for loop
for loop

A loop with initialization, boolean condition, and update sections, or the enhanced form that iterates over arrays and Iterable collections.

Related: while loop, continue statement
while 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.

Related: do while loop, for loop
do while loop

A loop that runs its body first and then tests the condition, so the body always executes at least once.

Related: while loop, for loop
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.

Related: array index exception, multidimensional array
multidimensional array

An array whose elements are themselves arrays, such as int[][], which need not be rectangular because each nested array can have a different length.

Related: array, array index exception
array index exception

The runtime exception (ArrayIndexOutOfBoundsException) thrown when an array is accessed with an index below zero or at least its length.

Related: array, null pointer exception
String immutability

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.

Related: StringBuilder, string pool
StringBuilder

A mutable sequence of characters offering append, insert, and reverse operations that change the same object, commonly used to build strings efficiently.

Related: String immutability, String pool
string pool

A cache of string literals in memory; identical literals share one object, while strings made with new String always create a distinct object.

Related: String immutability, equals method
equals method

The method used to compare logical content. Object's version compares references, so classes like String and wrapper types override it to compare values.

Related: string pool, wrapper class
ArrayList

A resizable-array implementation of List that grows automatically, supports index access, and stores objects rather than primitives.

Related: autoboxing, wrapper class
immutable date-time class

A java.time type such as LocalDate or LocalDateTime whose 'with' and 'plus' methods return a new instance instead of changing the original.

Related: String immutability, StringBuilder
main method

The entry point with the exact signature public static void main(String[] args), which the JVM invokes to start a standalone application.

Related: static method, varargs
static 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.

Related: static variable, main method
varargs

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.

Related: array, main method
getter

A public method, conventionally named getX or isX, that returns the value of a private field, often the read half of an encapsulated property.

Related: encapsulation, access modifier
package declaration

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.

Related: import statement, access modifier
import statement

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.

Related: package declaration, access modifier