What is Object Oriented Programming?
Object Oriented Programming is a way of writing software by grouping data and the behaviour that works on that data into units called objects. Instead of one long list of instructions, you model your program as real world things that talk to each other. This makes large codebases easier to organise, reuse, and maintain.
The simple idea
Imagine you are building an app for a bank. You have customers, accounts, and transactions. In Object Oriented Programming you create a blueprint for each of these things. That blueprint is called a class. When you actually create one customer or one account in memory, that is called an object.
Each object carries two things together. It carries data, which we call fields or attributes, and it carries actions, which we call methods. An Account object might store a balance and offer methods like deposit and withdraw. Everything about an account lives in one place, so the code stays tidy and easy to reason about.
A tiny example
class Account {
private double balance; // data
void deposit(double amount) { // behaviour
balance = balance + amount;
}
double getBalance() {
return balance;
}
}
// Using the class
Account myAccount = new Account(); // myAccount is an object
myAccount.deposit(500);
System.out.println(myAccount.getBalance()); // 500.0
Here Account is the class, or blueprint. The variable myAccount is a real object built from that blueprint. The balance is hidden inside and can only be changed through the deposit method, which keeps the data safe.
Why teams use it
- Organisation: related data and behaviour stay together, so code is easier to find.
- Reuse: once you write a class you can create many objects from it and reuse it across projects.
- Maintenance: a change to how an account behaves lives in one class, not scattered everywhere.
- Modelling: it maps naturally to real world things, which makes designs easier to talk about.
In an interview, define it in one clean sentence first, then give a real world example like a Car or an Account. Interviewers love that you can connect the concept to something concrete instead of only reciting a textbook line.
Common follow up questions
Related interview questions
Want the full OOP guide?
Read every OOP concept with notes, diagrams, and code in one place. Track your progress as you go.
Open the OOP guide All OOP questions