articles

Home / DeveloperSection / Articles / Introduction of object,class and object orientation

Introduction of object,class and object orientation

Hemant Patel 1922 20-Jan-2017

 Object:-  Anything which can be seen or touched should be treated as an object.

Every object has following two characterstics:-

1.    Attribute

2.    Behaviors

1.    Attributes:- Property of object is known as attributes.

e.g:- Marker object has following attributes:-

 1. Color

 2. Weight

 3. Height

 4. Size

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
create objects.

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.

                   class Circle
                   {
                   int radius;
                   void setRadius(int r)
                     {
                             radius=r;
                      }
                   void findArea()
                        {
                             double area=3.14*radius*radius;
                             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

Features of Java: Simple, Small and Object Oriented



Updated 31-Mar-2019
Exploring the online world is my passion. have experience of #content writing #SEO #Digital Marketing #On-Page #Lead Generation #Content Analyst #Marketing Analyst... I could never stop at one point, continuously wanted to acquire more and more skills. My work for any organization will be full of passion and hard work.

Leave Comment

Comments

Liked By