CLASS:
A class is a template or blueprint from which objects are created.. Example of a class: Cars, Employee, Shapes etc.
Syntax:
class class-Name
{
//variables /methods/constructors
}
Relationship between Classes:
Classes share 3 types of relationship between each other.
- Dependance(uses-a)
- Aggregation(has-a)
- Inheritance(is-a)
OBJECTS:
An object is an instance of a class.
The relationship is such that many objects can be created using one
class. Each object has its own data but its underlying structure (i.e.,
the type of data it stores, its behaviors) are defined by the class.
Tags:
Java,
Class,
Object