Object Oriented Programming

Introduction to classes and objects in Java

Introduction to classes and objects in Java:


Class is a template from which we create objects. Class is a cellection of objects.


Instance of a class is called object of that class. Objects are the reusable software components. There are different types of objects like date objects, time objects, audio objects, video objects and People objects etc. Every object has some attributes and some behaviors. For example, we consider an automobile object CAR, then car must have its attributes like color, price, number of door atc, and also must have some behaviors like accelerates, decelrates etc.

Basic Class Structure:

public class ClassName


// instance and class variables are here

// instance and class methods are here


Creating Object of Above Defined Class:

ClassName objectName = new ClassName( );
%d bloggers like this: