Tuesday , February 20 2018
Home / Java Programming / Object Oriented Programming / Introduction to classes and objects in Java

Introduction to classes and objects in Java

Introduction to classes and objects in Java:

Class:

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

Object:

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( );
(Visited 27 times, 1 visits today)

Check Also

What are the set methods and get methods?

What are the set methods and get methods? The set methods are the methods in …