OOP · Building Blocks of OOP
Creating Multiple Objects
In real-world applications, we rarely deal with just one object.
Introduction
In real-world applications, we rarely deal with just one object. A school has hundreds of students, a bank has thousands of accounts, and an e-commerce website has millions of products. Instead of writing separate variables for every entity, OOP allows us to create multiple objects from a single class.
Problem Without a Class Imagine storing information for 100 students.

Each new produces an independent object with its own copy of the instance fields.
class Counter {
int count = 0;
void tick() { count++; }
}
public class Main {
public static void main(String[] args) {
Counter c1 = new Counter();
Counter c2 = new Counter();
c1.tick();
c1.tick();
c2.tick(); // c2 is unaffected by c1
System.out.println(c1.count); // 2
System.out.println(c2.count); // 1
}
}