Home > DeveloperSection > Interviews > What are Java Classes and Objects?

Posted on    November-09-2015 3:53 AM

 Java Java 
Ratings:
 1 Answer(s)
  301  View(s)
Rate this:

Devesh Kumar Singh

Total Post:12

Points:60
Posted on    November-09-2015 4:53 AM

The term ‘class’ refers to the actual written piece of code which is used to define the behavior of any given class. So, a class is a static piece of code that consists of attributes which don’t change during the execution of a program – like the method definitions within a class. It is like a blueprint for creating different objects which defines its properties and behaviors. . A class can contain fields and methods to describe the behavior of an object.

 

The term ‘object’, however, refers to an actual instance of a class. Every object must belong to a class. Objects are created and eventually destroyed – so they only live in the program for a limited time. While objects are ‘living’ their properties may also be changed significantly. Objects exhibit the properties and behaviors defined by its class.


Don't want to miss updates? Please click the below button!

Follow MindStick