Object:- Anything which can be seen or touched should be treated as an object.
Every object has following two characterstics:-
1. Attributes:- Property of object is known as attributes.
e.g:- Marker object has following attributes:-
An object is nothing without attributes.
Programming wise an object is nothing.It is simply a location in memory.
This location can have several fields to store data (information). This location may contain several fields (variables). To store attribute values.
A field can store only one data at a time.
Every field will be attributes of the object.
2. Behaviors of the object:- These are the method that are the executed to
perform operation on the fields(attributes) of the object.
Class:- A class defines attributes and behaviors of the objects.It will be used to
A class defines attribute and behaviours of the objects. So every program uses class to create object in memory.
It means if you want to develop a program,that can create objects during execution then you need to define atleast one class in that program,because class is a blue print of an object (since it contains attributes and the behavior of the object).In the class we need to define variables and methods.
Variable will be attributes of the object or fields of the object.These fields will store data about the object.
Methods will be behaviours of the objects.These methods will perform operation on the fields of the object such as storing data into fields. Changing data of the fields,searching data etc.
void setRadius(int r)
System.out.ptintln(“Area of the circle is ”+ area);
Object orientation:- If you want to developed a program that can create objects during execution,then you will have to define, at least one class in that program.
In this class you will have to define variables and methods.
Variable will be attributes of the object and method will be behaviours of the objects.
class Name -> // Define Object
variables; -> // attribute of the object
methods; -> // behaviours of the object
As we can see entire coding of the above syntax has been done to create objects. This process is known as object orientation, and program is known as object oriented program (oops), and programming language known as object oriented programming language.
You can also visit this related articles