Java
|
General Terms
- Identifiers: names of types, variables, methods, packages.
- Access Modifiers:
public
, private
, protected
, package-private (default).
- package: a namespace mechanism to organize related classes and interfaces.
- Class: a blueprint or template for creating objects.
- Abstract Class: a class that cannot be instantiated and may contain abstract methods.
- Interface: a contract that defines methods a class must implement.
- Object: an instance of a class.
- Instance: a specific occurrence of an object created from a class.
- Fields: variables that belong to a class or instance.
- Instance Variables: belong to a specific instance.
- Class Variables or Static Variables: shared among all instances of a class.
.
- Methods: functions that define behavior of a class.
- Instance Methods: operate on instance variables and require an object to be called.
- Static Methods or Class Methods: belong to the class itself, not to any instance.
.
- Constructor: special method used to initialize objects when they are created.
- Initializer Block: code block that runs when an instance is created.
- Static Initialization Block: code block that runs when a class is first loaded.
- Object Type: the type of the object is defined by its class.
- Object State: the state of the object is defined by its instance and class variables.
- Object Behavior: the behavior of the object is defined by its methods.
- Variable Declaration: specify a name and type for the variable (syntax:
TYPE VAR_NAME;
).
- Variable Initialization: assign an initial value to the variable (syntax:
VAR_NAME = VALUE;
).
- Variable Assignment: assign a new value to an already declared variable.
- Method Signature: the method name and parameter types (used for method identification).
- Method Declaration: specify a name, return type, parameters, and modifiers for the method.
- Method Definition: write the implementation code for the method.
- Method Parameters: variables used in the method declaration.
- Method Arguments: actual values passed when the method is called.
- Varargs Method: a method with a variable number of parameters
method(Object... objs)
.
- The Ellipsis
...
syntax allows passing zero or more arguments of the specified type.
- Inheritance: mechanism where a class inherit properties and behaviors from another class.
- Superclass | parent class | base class: the class being inherited from.
- Subclass | child class | derived class: the class that inherits from another class.
- Extend a Class: inherit from a class using the
extends
keyword.
- Implement an Interface: provide concrete implementations for interface methods using
implements
.
- Method Overriding: providing a new implementation for an inherited method.
Used to customize behavior inherited from the superclass.
- Overridden Method: the original method in the superclass.
- Overriding Method: the new method in the subclass.
- Method Overloading: defining multiple methods with the same name but different parameters.
- Method Hiding: when a static method in a subclass has the same signature as a static method in the superclass.
- Polymorphism: the ability of an object variable to reference objects of different types (superclass reference can point to subclass instances).
- Dynamic Binding (late binding): the ability to select the correct method implementation at runtime based on the actual object type.
- Static Binding (early binding): the compiler's ability to resolve at compile time which method to call (
private
, static
, final
methods, or constructors).
- Inlining: optimization where the compiler or JVM replaces method calls with the actual method code for performance.
- Cohesion: measure of how closely related the responsibilities of a single module are.
- High Cohesion (desirable): elements within a module work toward a single, well-defined task.
- Low Cohesion (undesirable): elements within a module have diverse responsibilities.
.
- Coupling: measure of how much one module depends on other modules.
- Loose Coupling (desirable): modules have minimal dependencies on each other.
- Tight Coupling (undesirable): modules are highly dependent on each other.
.
- Exception: an event that disrupts the normal flow of program execution.
- Throw an Exception: explicitly raise an exception using the
throw
keyword.
- Checked Exception: an exception verified by the compiler, which must be declared by the method or handled in a
try-catch
block.
- Unchecked Exception: runtime exceptions not checked by the compiler, which don't need to be declared or handled.
.
- Thread: a lightweight subprocess that allows concurrent execution within a program.
- Daemon Thread: a background thread that doesn't prevent the JVM from exiting.
- Process: an independent program in execution with its own memory space.
- Stack: a region of memory that stores method calls, local variables, and partial results.
- Generics: feature that provides type safety by allowing parameterized types.
- Raw Type: using a generic class without specifying type parameters (
ArrayList
instead of ArrayList<String>
).
- Diamond Operator: syntax that allows type inference (
new ArrayList<>()
).
- Parameterized Type | type parameter: the actual type specified for a generic class or method.
- Wrapper Class: object representation of primitive types (
Integer
is a wrapper class for the int
primitive type).
- Autoboxing: automatic conversion between primitive types and their wrapper classes.
- Automatic Boxing: primitive to wrapper conversion (
Integer i = 1
).
- Automatic Unboxing: wrapper to primitive conversion (
int x = i;
where i is Integer
).
{}
braces: delimit blocks, method bodies, class bodies, array initialization.
[]
square brackets: array declaration, array element access, annotations.
'
single quote: delimit a character literal.
"
double quote: delimit a string literal.
- Long Integer Literals have a suffix l or L:
1l
, 1L
.
- Float Literals have a suffix f or F:
1.0f
, 1.0F
.
- Double Literals can optionally have a suffix d or D:
1.0
, 1.0d
, 1.0D
.
- Hexadecimal Literals have a prefix
0x
or 0X
: 0x1A
, 0X1a
.
- Octal Literals have a prefix
0
: 077
.
- Binary Literals have a prefix
0b
or 0B
: 0b1010
, 0B1010
.
- Unicode Escape Sequences use the prefix
\u
: \u0041
(represents 'A'), \uFFFF
.