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
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
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();