Java_OOPS
Java_OOPS
Fields
Methods
Constructors
Blocks
Nested class and interface
class class_name
{
field;
method;
}
What is an Object?
------------------
An entity that has state and behavior is known as an object e.g., chair, bike,
marker, pen, table, car, etc. It can be physical or logical (tangible and
intangible).
The example of an intangible object is the banking system.
For Example, Pen is an object. Its name is Reynolds; color is white, known as its
state. It is used to write, so writing is its behavior.
Object Definitions:
------------------
An object is a real-world entity.
An object is a runtime entity.
The object is an entity which has state and behavior.
The object is an instance of a class.
Method in Java
-------------
In Java, a method is like a function which is used to expose the behavior of an
object.
Advantage of Method
Code Reusability
Code Optimization