- Object-Oriented Programming tries to map code instructions with real-world, making the code short and easier to understand.
- With the help of OOPs, we try to implement real-world entities such as object, inheritance, abstraction, etc.
- OOPs helps us to follow the DRY(Don't Repeat Yourself) approach of programming, which in turn increases the reusability of the code.
- A class is a blueprint for creating objects.
- Classes do not consume any space in the memory.
- Objects inherit methods and variables from the class.
- It is a logical component.
- An object is an instantiation of a class. When a class is defined, a template (info) is defined.
- Every object has some address, and it occupies some space in the memory.
- It is a physical entity.
- Take a look at the below example to get a better understanding of objects and classes :
- We identify the following:
Noun - Class - Employee
Adjective - Attributes - name, age, salary
Verb - Methods - getSalary(), increment()
- This is all for this tutorial. We will do a detailed discussion on every aspect of OOPs in further tutorials.
Handwritten Notes: Click to Download
Ultimate Java Cheatsheet: Click To Download