Java Definations
Java Definations
Platform Independent
Object-Oriented
Multithreaded
boolean → true/false
🔸 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
🔸 Loops
🔸 Jump Statements
🔹 7. Constructors
🔸 Constructor
A special method invoked when an object is created.
Car() {
// constructor
}
🔸 Types
Default
Parameterized
🔹 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 {
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
🔹 11. Strings
🔸 String (Immutable)
String s = "Hello";
🔸 StringBuilder (Mutable)
Preferred when string is modified multiple times.
🔸 Set
🔸 Map
🔸 Queue
FIFO structure (PriorityQueue, Deque)
🔹 14. Multithreading
🔸 Thread
A lightweight subprocess for parallel execution.
🔸 Creating Threads
🔹 21. Packages
Used to group related classes.
Example:
package com.myapp;