Class and Object
Class: Class is a data type. It is also called blueprint or template. class contain number of object.
Object: Object is a run time entity. It is a active entity.
Example of class and object
class student
{
int roll_no, age;
void get(int roll_no1, int age1)
{
roll_no = roll_no1;
age = age1;
}
void show()
{
System.out.println(roll_no);
System.out.println(age);
}
public static void main(String k[])
{
student st=new student();
st.get(1,16);
st.show();
}
}

No comments:
Post a Comment