Java Short Note
Java Short Note
Java Short Note
Object-Oriented Programming (OOPs) is a type of programming that is based on objects rather than
just functions and procedures. Individual objects are grouped into classes. OOPs implements real-
world entities like inheritance, polymorphism, hiding, etc. into programming. It also allows binding
data and code together.
Inheritance
Encapsulation
Polymorphism
Data Abstraction
5. What is an object?
An object is a real-world entity which is the basic unit of OOPs for example chair, cat, dog, etc.
Different objects have different states or attributes, and behaviors.
6. What is a class?
A class is a prototype that consists of objects in different states and with different behaviors. It has a
number of methods that are common the objects present within that class.
Class: User-defined blueprint from which objects are created. It consists of methods or set of
instructions that are to be performed on the objects.
Structure: A structure is basically a user-defined collection of variables which are of different data
types.
8. Can you call the base class method without creating an instance?
Yes, you can call the base class without instantiating it if:
a static method
The base class is inherited by some other subclass
Object Class
A class is basically a template or a blueprint
A real-world entity which is an instance of a class
within which objects can be created
Binds methods and data together into a single
An object acts like a variable of the class
unit
An object is a physical entity A class is a logical entity
Objects take memory space when they are A class does not take memory space when
created created
Objects can be declared as and when required Classes are declared just once
Increases the time and effort required to execute a program as it requires jumping back and
forth between different classes
The parent class and the child class get tightly coupled
Any modifications to the program would require changes both in the parent as well as the
child class
Needs careful implementation else would lead to incorrect results