Here is an in-depth version of the Core Java topic-wise definitions, with expanded
explanations and examples to deepen your understanding.
🟦 In-Depth Core Java Topic-Wise
Definitions
🔹 1. Java Fundamentals
🔸 Java
A high-level, object-oriented, and platform-independent
programming language developed by Sun Microsystems
(now Oracle). Java applications are compiled into bytecode
and run on the Java Virtual Machine (JVM).
🔸 Features of Java
Platform Independent
Object-Oriented
Robust & Secure
Multithreaded
Automatic Garbage Collection
🔹 2. JDK, JRE, JVM
🔸 JDK (Java Development Kit)
A full development environment that includes JRE +
compiler + debugger + tools required to develop Java
applications.
🔸 JRE (Java Runtime Environment)
Provides libraries + JVM to run Java programs. It does not
contain tools for development.
🔸 JVM (Java Virtual Machine)
A virtual engine that interprets compiled .class (bytecode)
files. JVM makes Java platform-independent.
🔹 3. Data Types and Variables
🔸 Primitive Data Types
byte, short, int, long → numeric (integer)
float, double → floating point
char → single character
boolean → true/false
🔸 Non-Primitive (Reference) Types
Arrays, Strings, Classes, Interfaces
🔸 Variable
A name associated with a memory location to store data.
int age = 25;
String name = "Likhitha";
🔹 4. Operators
Type Operators
Arithmeti
+, -, *, /, %
c
Relational ==, !=, >, <, >=, <=
Logical &&, `
Assignme
=, +=, -=, *=, /=, %=
nt
Unary +, -, ++, --
Ternary condition ? true_value : false_value
🔹 5. Control Statements
🔸 Decision Making
if, if-else, nested-if, switch-case
🔸 Loops
for, while, do-while for iteration
🔸 Jump Statements
break → exits loop/switch
continue → skips current iteration
return → exits from method
🔹 6. Object-Oriented Programming (OOPs)
🔸 Class
A blueprint for creating objects.
class Car {
String brand;
void drive() {
System.out.println("Driving...");
}
}
🔸 Object
An instance of a class with its own state and behavior.
🔸 Encapsulation
Hiding internal details using private variables and providing
public setters/getters.
🔸 Abstraction
Hiding implementation using abstract classes or interfaces.
🔸 Inheritance
Mechanism by which one class can inherit properties from
another using extends.
class Animal {}
class Dog extends Animal {}
🔸 Polymorphism
Ability to take many forms:
Method Overloading (compile time) – same method name, different parameters
Method Overriding (runtime) – same method in subclass with different behavior
🔹 7. Constructors
🔸 Constructor
A special method invoked when an object is created.
Car() {
// constructor
}
🔸 Types
Default
Parameterized
Copy Constructor (not built-in like C++)
🔹 8. Access Modifiers
Modifie Same Same Subcla Other
r Class Package ss Packages
private ✅ ❌ ❌ ❌
(default) ✅ ✅ ❌ ❌
protecte
✅ ✅ ✅ ❌
d
public ✅ ✅ ✅ ✅
🔹 9. Exception Handling
🔸 Exception
An unwanted or unexpected event that disrupts program
flow.
🔸 Keywords
try, catch, finally, throw, throws
try {
int x = 10 / 0;
} catch (ArithmeticException e) {
System.out.println("Divide by zero!");
} finally {
System.out.println("Always executed.");
}
🔹 10. Arrays
🔸 Array
Collection of similar type of elements.
int[] numbers = {1, 2, 3};
Single-dimensional
Multi-dimensional (2D arrays)
🔹 11. Strings
🔸 String (Immutable)
String s = "Hello";
🔸 StringBuilder (Mutable)
Preferred when string is modified multiple times.
🔹 12. Abstract Class vs Interface
Feature Abstract Class Interface
Can have Abstract &
Only abstract (Java 7)
methods concrete
Variables Can have fields Public static final only
Inheritance Single inheritance Multiple inheritance
🔹 13. Collections Framework
🔸 List
Allows duplicates, maintains insertion order (ArrayList, LinkedList)
🔸 Set
No duplicates (HashSet, TreeSet)
🔸 Map
Key-value pairs (HashMap, TreeMap)
🔸 Queue
FIFO structure (PriorityQueue, Deque)
🔹 14. Multithreading
🔸 Thread
A lightweight subprocess for parallel execution.
🔸 Creating Threads
Extending Thread class
Implementing Runnable interface
class MyThread extends Thread {
public void run() {
System.out.println("Running");
}
}
🔸 Thread States
New → Runnable → Running → Blocked → Terminated
🔸 Synchronization
Prevents multiple threads from accessing shared resources at
the same time.
🔹 15. File Handling
🔸 File I/O Classes
File, FileReader, FileWriter, BufferedReader, BufferedWriter
BufferedReader br = new BufferedReader(new FileReader("data.txt"));
🔹 16. Static Keyword
Static variable: shared by all instances
Static method: called without object
Static block: runs once when class loads
🔹 17. Final Keyword
Final variable: constant
Final method: cannot be overridden
Final class: cannot be inherited
🔹 18. Wrapper Classes
Converts primitives to objects:
int → Integer, float → Float, char → Character
🔸 Auto-boxing / Unboxing
Integer x = 10; // auto-boxing
int y = x; // unboxing
🔹 19. Type Casting
Widening (auto): byte → short → int → long → float → double
Narrowing (manual): double → float → long → int → short → byte
int x = (int) 5.75;
🔹 20. Garbage Collection
JVM automatically reclaims memory by removing
unreachable objects.
🔸 finalize() method
Called before object is destroyed (not guaranteed to run).
🔹 21. Packages
Used to group related classes.
Example:
package com.myapp;
import used to access other packages.