0

What is the definition of a Class , Object and an Instance and what is the difference between an Instance and an Object.

I would like my answer in Simple English

  • https://stackoverflow.com/questions/2885385/what-is-the-difference-between-an-instance-and-an-object – xingbin Dec 30 '18 at 11:43

1 Answers1

0

Class is collection of various objects, variables, functions etc.

class DemoClass {

    void method(){
       ......
    }   
}

When you want to create a new instance of a class you need to create a new object of that class.

DemoClass dc = new DemoClass();

You can then access this instance (methods etc. of this instance) from the object you created.

dc.method();
Mehul Pamale
  • 349
  • 3
  • 13