Welcome to the Byte-Code Glossary! Whether you’re new to Java or need a refresher, this glossary is here to help you understand common terms and concepts in Java programming.
A
Abstract Class
Definition: A class that cannot be instantiated on its own and is meant to be subclassed. It can have both abstract methods (without implementation) and concrete methods (with implementation).
abstract class Animal { abstract void sound(); }
API (Application Programming Interface)
- Definition: A set of classes, methods, and interfaces that allows developers to interact with an application or service. In Java, APIs like the Java Standard API provide pre-built functions and classes.
B
Bytecode
- Definition: A set of instructions that the Java Virtual Machine (JVM) executes. Java source code is compiled into bytecode, which is platform-independent and can be run on any system with a JVM.
- Example:
.class
files contain Java bytecode.
C
Class
Definition: A blueprint for creating objects in Java. It defines attributes (fields) and behaviors (methods) of the objects.
Example:
public class Car { String model; void start() { // code to start the car } }
Constructor
- Definition: A special method used to initialize objects. It has the same name as the class and does not have a return type.
- Example:
public class Car { public Car() { // constructor code } }
D
Dependency Injection
- Definition: A design pattern used to achieve Inversion of Control (IoC) by passing dependencies (like objects or services) to a class instead of the class creating them.
- Example: Often used in frameworks like Spring.
E
Encapsulation
- Definition: A principle of wrapping data (variables) and methods (functions) that operate on the data into a single unit, typically a class. It also restricts direct access to some of an object’s components.
- Example:
public class Person { private String name; public void setName(String name) { this.name = name; } public String getName() { return name; } }
F
Framework
- Definition: A set of pre-written code that provides a structure to follow for developing software applications. Examples include Spring, Hibernate, and JavaFX.
G
Garbage Collection
- Definition: The process by which the JVM automatically identifies and removes objects that are no longer in use to free up memory resources.
- Example: The
System.gc()
method suggests the JVM to perform garbage collection.
H
Heap Memory
- Definition: A memory area where Java objects are stored. It’s divided into the Young Generation and Old Generation spaces.
- Example: Objects created with
new
keyword are stored in the heap.
I
Interface
Definition: A reference type in Java, similar to a class, that can contain only constants, method signatures, default methods, static methods, and nested types. Interfaces cannot contain implementation of methods (until Java 8’s default methods).
Example:
interface Animal { void eat(); }
J
JVM (Java Virtual Machine)
- Definition: The engine that runs Java bytecode on any machine. It abstracts the underlying hardware and OS, providing a platform-independent execution environment.
- Example: The JVM interprets bytecode files generated by the Java compiler.
K
Keyword
- Definition: Reserved words in Java that have a predefined meaning and cannot be used for variable names, method names, or any other identifiers.
- Example:
class
,public
,static
,void
, etc.
L
Lambda Expression
- Definition: Introduced in Java 8, a lambda expression is a concise way to represent anonymous functions (a method without a name) using a syntax that is more compact.
- Example:
(int x, int y) -> x + y
M
Method Overloading
- Definition: The ability to define multiple methods with the same name but different parameters within the same class.
- Example:
public int add(int a, int b) { return a + b; } public double add(double a, double b) { return a + b; }
N
Null Pointer Exception (NPE)
- Definition: An exception that occurs when an application attempts to use an object reference that has the null value.
- Example: Accessing a method or variable of a null object reference.
O
Object-Oriented Programming (OOP)
- Definition: A programming paradigm based on the concept of objects, which can contain data and methods. Java is an object-oriented programming language.
- Example: Key principles include inheritance, encapsulation, polymorphism, and abstraction.
P
Polymorphism
- Definition: The ability of a single interface or method to operate on different data types or objects. It allows methods to be used in a way that depends on the object that is being acted upon.
- Example:
Animal myDog = new Dog();
myDog.sound(); // Can call the Dog's sound method.
Q
Queue
- Definition: A collection designed for holding elements prior to processing. It follows the First-In-First-Out (FIFO) principle.
- Example:
LinkedList
can be used as a Queue in Java.
R
Runtime Exception
- Definition: An exception that occurs during the execution of a program. These are unchecked exceptions and are not required to be handled or declared.
- Example:
NullPointerException
,ArrayIndexOutOfBoundsException
.
S
Synchronized
- Definition: A keyword in Java that restricts access to a block of code or method to only one thread at a time, ensuring thread safety.
- Example:
public synchronized void increment() { counter++; }
T
Thread
Definition: A thread is a lightweight process that can run concurrently with other threads. Java supports multithreading through the Thread
class or implementing the Runnable
interface.
Example:
class MyThread extends Thread { public void run() { System.out.println("Thread is running"); } }
U
UML (Unified Modeling Language)
- Definition: A standardized modeling language used to visualize the design of a system. UML diagrams like class diagrams are often used in software development.
- Example: Use cases, sequence diagrams.
V
Variable
- Definition: A container that holds data values that can be changed during the execution of a program.
- Example:
int number = 5;
W
Wrapper Class
- Definition: A class in Java that allows primitive data types to be treated as objects. Common wrapper classes include
Integer
,Double
, andBoolean
. - Example:
Integer num = Integer.valueOf(5);
X
XML (eXtensible Markup Language)
- Definition: A markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. Java uses XML extensively in configurations, data storage, and web services.
- Example: XML configuration files for Spring or Hibernate.
Y
Yield
Definition: A method in Java’s Thread
class that causes the currently executing thread to pause and allow other threads to execute.
Example:
Thread.yield();
Z
Zero-based Indexing
- Definition: A method of numbering in which the first element of a series is assigned the index number zero, common in Java arrays and other data structures.
- Example: In a Java array,
arr[0]
accesses the first element.