0% found this document useful (0 votes)
7 views2 pages

Notes On OOP

yeah just some notes

Uploaded by

discodiscostuck
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Notes On OOP

yeah just some notes

Uploaded by

discodiscostuck
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CHAPTER – 2

ELEMENTARY CONCEPTS OF OBJECTS AND CLASS


Difference between Class and Object

Class Object
It is a representation of similar types of It is a unique entity having some
objects. characteristics and behaviours.

It is a blue print of an object. It is created with the help of ‘new’


operator.
It is known as ‘Object Factory’. It is known as ‘Instance of a Class’.

Syntax of creating an object of a class

ClassName ObjectName = new ClassName( ) ;

Constructor

eg. sum ob = new sum( );

Write a java statement to create an object mp4 of class digital.

digital mp4 = new digital( );

Attributes – are the characteristics or data members of an object.

new operator – This keyword is used to allocate space in dynamic memory for the
storage of data and functions belonging to an object

Class as USER DEFINED DATA TYPE

Class is created by user and so is its data and function. This makes class,
user defined. While creating an object, class becomes the data type of that object,
thus enabling the object to possess its properties (data and function). Thus class
becomes a user defined data type.

eg. sum ob = new sum( );

The user defined class ‘sum’ becomes the datatype of the object ‘ob’, which acquires
the properties of the class.
Class as OBJECT FACTORY

Class is used to create objects having similar feature. Hence class is referred
to as object factory. Each object of the class possess characteristics (data) and
behaviour (function) defined within the class.

eg. sum ob = new sum( );

Class as COMPOSITE DATA TYPE

Class is a user defined data type. Class contain data values of various types,
such as String, integer, double etc. Since class is a collection of different primitive
data types, it is known as Composite data type.

eg. class student {

int roll, class;


String name;
double marks;
char section; }

Class as ABSTRACT DATA TYPE

When a class is created, the data is merged with the belonging functions.
Objects can communicate with each other only through functions without having
direct interaction with the data members. This shows that class is an abstraction for
the set of its objects.

eg. ob . getvalue( ); Function


Object

OBJECT as an INSTANCE OF A CLASS

Since objects are created from class, they are referred to as an instance of a
class. Each object of the class possesses characteristics (data) and behaviour
(function) defined within the class.

eg. sum ob = new sum( );

_________________________

You might also like