Bootstrap 3

About Us

Classand interface


class Example{

int id; //data member (also instance variable)

String name; //data member(also instance variable)

public static void main(String args[]){

Example e1=new Example(); //creating an object of Student

System.out.println(e1.id);

System.out.println(e1.name);

}

}

Difference between object and class


Object


1) Object is an instance of a class.

2) Object is a physical entity.

3) Object is created through new keyword e.g.

Java j=new Java();

4) Object allocates memory when it is created.

Class


1)Class is a blueprint from which objects are created.

2)Class is a logical entity.

3)Class is declared usi