It’s time for Vocabulary 🤖 Java Concepts Glossary
1.1 Class
Definition: A blueprint for creating objects, containing methods and attributes. Example:
public class Vehicle {
// Attributes and methods here
}
1.2 Object
Definition: An instance of a class. Example:
Vehicle myCar = new Vehicle();
1.3 Method
Definition: A function defined inside a class. Example:
public void drive() {
// Method implementation
}
1.4 Constructor
Definition: A special method used to initialize objects. Example:
public Vehicle() {
// Constructor code
}
1.5 Inheritance
Definition: A mechanism where one class acquires the properties and behaviors of another class. Example:
public class Car extends Vehicle {
// Car class code
}
1.6 Interface
Definition: A template that can be applied to a class. Similar to a class, but with methods that have no implementation. Example:
public interface Drivable {
void drive();
}
1.7 Encapsulation
Definition: Keeping the data (attributes) and the code (methods) safe from external interference. Example:
private int speed;
public int getSpeed() {
return speed;
}
1.8 Polymorphism
Definition: A concept where one interface can be used for a general class of actions. Example:
Vehicle myVehicle = new Car();
1.9 Abstract Class
Definition: A class that cannot be instantiated. It can only be used as a superclass. Example:
public abstract class Shape {
abstract void draw();
}
1.10 Static
Definition: Belongs to the class, rather than a specific instance. Used for methods and attributes. Example:
public class Vehicle {
public static int numberOfWheels = 4;
}
1.11 Protected
Definition: The attribute or method is accessible within its own package and by subclasses. Example:
protected int speed;
1.12 Final
Definition: Used to declare constants or methods that cannot be overridden, or classes that cannot be subclassed. Example:
public final int MAX_SPEED = 120;
1.13 Public
Definition: Indicates that the method or attribute can be accessed from any other class. Example:
public void drive() {
// Method implementation
}
1.14 Private
Definition: Restricts the visibility of a class member; only accessible within the class it is declared. Example:
private int fuel;
1.15 Variable
Definition: A container for storing data values. Variables in Java must have a specific data type. Example:
int number = 5;
1.16 Package
Definition: A namespace for organizing classes and interfaces in Java. Packages are used to avoid naming conflicts and to control access. Example:
package com.example.myapp;
1.17 Array
Definition: A container object that holds a fixed number of values of a single type. Example:
int[] numbers = new int[10];
1.18 Exception
Definition: An event that disrupts the normal flow of the program’s instructions. In Java, exceptions are objects that are thrown and caught. Example:
try {
// Code that may throw an exception
} catch (Exception e) {
// Code to handle the exception
}
1.19 Loop
Definition: A sequence of instructions that is continually repeated until a certain condition is reached. Example:
for (int i = 0; i < 10; i++) {
// Code to be repeated
}
1.20 Thread
Definition: A thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads running concurrently. Example:
class MyThread extends Thread {
public void run() {
// Code to be executed in a new thread
}
}
1.21 Attribute
Definition: A variable within a class, also known as a field or member. Example:
public class Vehicle {
private int speed; // Attribute
}
1.22 Compiler
Definition: A tool that translates source code into executable code. In Java, the source code in .java
files is compiled to bytecode in .class
files.
Example: The Java compiler (javac
) compiles Java source files into bytecode.
1.23 Bytecode
Definition: An intermediate code between source code and machine code, which the Java Virtual Machine (JVM) executes. Example: Java bytecode generated by the compiler is platform-independent and executed by the JVM.
1.24 Java Virtual Machine (JVM)
Definition: An abstract machine that enables a computer to run Java programs. Example: The JVM reads and executes bytecode for Java applications.
1.25 Java Development Kit (JDK)
Definition: A software development kit used to develop Java applications. It includes the Java Runtime Environment (JRE), an interpreter/loader (Java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), and other tools needed in Java development. Example: The JDK must be installed to develop Java applications.
1.26 Java Runtime Environment (JRE)
Definition: A part of the Java Development Kit (JDK); it provides libraries, the JVM, and other components to run applications written in Java. Example: The JRE is required to run Java applications on any platform.
1.27 Garbage Collection
Definition: A process by which the JVM reclaims memory from objects that are no longer in use, thus managing memory automatically. Example: In Java, garbage collection helps in efficient memory management by deleting unused objects.
1.28 Truncation
Definition: Truncation refers to the process of shortening a number by removing digits after the decimal point, without rounding. In programming, this is commonly seen when converting a floating-point number to an integer.
Example:
int x = (int) 5.89; // x becomes 5
In this example, the decimal portion (.89
) is discarded, and the value is truncated to 5
.
Truncation is useful when you need the whole number part of a value and want to ignore its fractional component.
1.29 Primitive Data Types
Definition: Basic data types built into Java that store simple values (not objects). Example:
int age = 25; // Integer
double price = 9.99; // Decimal number
boolean isActive = true; // True/false
char grade = 'A'; // Single character
1.30 String
Definition: A class representing a sequence of characters (text). Strings are immutable (cannot be changed after creation). Example:
String name = "Alice";
1.31 Conditional Statement
Definition: Code structure that executes different actions based on whether a condition is true/false. Example:
if (temperature > 30) {
System.out.println("Hot day!");
} else {
System.out.println("Pleasant day.");
}
1.32 Import Statement
Definition: Directive to include external classes/packages in your code. Example:
import java.util.Scanner; // Allows using the Scanner class
1.33 Null
Definition: A special value indicating the absence of an object reference (no object assigned). Example:
String message = null; // No string object exists
1.34 Overloading
Definition: Defining multiple methods with the same name but different parameters. Example:
public int add(int a, int b) { return a + b; }
public double add(double a, double b) { return a + b; }
1.35 Main Method
Definition: The entry point where Java starts executing a program. Required in every executable Java application. Example:
public static void main(String[] args) {
System.out.println("Program started!");
}
1.36 Debugging
Definition: The process of finding and fixing errors (bugs) in code. Example: Using breakpoints in an IDE to pause execution and inspect variables.
1.37 Algorithm
Definition: A step-by-step procedure to solve a problem or perform a computation. Example: A recipe for sorting a list of numbers.
1.38 IDE (Integrated Development Environment)
Definition: Software that combines code editing, debugging, and build tools in one interface. Example: IntelliJ IDEA, Eclipse, or VS Code with Java extensions.
1.39 Syntax
Definition: The set of rules that define correctly structured code in a programming language. Example: Semicolons (;) ending statements in Java.
1.40 Return Statement
Definition: Ends a method’s execution and optionally sends a result back to the caller. Example:
int square(int x) {
return x * x; // Sends result back
}