OBJECT ORIENTED PROGRAMMING WITH JAVA
CHAPTER 4
What is a class?
Ans) A class
is a blue print or poto type from which objects are created .class define
entities that usually represent real world objects.
Pen,chair,college
and student realworld entities that are represented by class.
A class has
class signature ,optional constructors data memberand methods.
[java
modifier] class class name {
//data
members
//constructors
//methods
}
Class student{
int rollno; data member
String name;
String technology;
}
Public static void[show data()]{
System.out.println(“roll
no=”+roll no);
System.out.println(”name=”name);
System.out.println(“technology=”+technology)
}
}
What is
object?
Ans) An object
instance of a class.
Student S1=new
student();
S1.roll no=”11”;
S1.name=”ALI”;
S1.tech=”I.T”;
S1.show
data=();