Skip to main content

A class is basically a definition, and contains the object's code. An object is an instance of a class

for example if you say

String word = new String(); 

the class is the String class, which describes the object (instance) word.

When a class is declared, no memory is allocated so class is just a template.

When the object of the class is declared, memory is allocated.

A class is basically a definition, and contains the object's code. An object is an instance of a class

for example if you say

String word = new String(); 

the class is the String class, which describes the object (instance) word.

A class is basically a definition, and contains the object's code. An object is an instance of a class

for example if you say

String word = new String(); 

the class is the String class, which describes the object (instance) word.

When a class is declared, no memory is allocated so class is just a template.

When the object of the class is declared, memory is allocated.

Source Link
mustafabar
  • 2.4k
  • 6
  • 32
  • 48

A class is basically a definition, and contains the object's code. An object is an instance of a class

for example if you say

String word = new String(); 

the class is the String class, which describes the object (instance) word.