2.1.ppt Java
2.1.ppt Java
In object-oriented
programming technique, we
design a program using
objects and classes.
An object in Java is the
physical as well as a logical
entity, whereas, a class in
Java is a logical entity only.
An object has three
characteristics:
An object is an instance of a class.
Object Definitions:
A class is a group of
objects which have
common properties.
It is a template or
blueprint from which
objects are created.
It is a logical entity.
It can't be physical.
CLASS DECLARATION
Syntax to declare a
class:
class <class_name>
{
field;
method;
}
Object Declaration
The object is a basic building block
of an OOPs language. In Java, we
cannot execute any program
without creating an object.
Ways to initiate object
{ s1.insertRecord(111,“sneha");
rollno=r;
s2.insertRecord(222,“sonal");
name=n; }
s1.displayInformation();
void displayInformation() {
s2.displayInformation();
System.out.println(rollno+" "+
} }
name);} }
To be continued……..
Next lecture