Java Classes and Objects

The class is at the core of Java. It is the logical concept upon which the entire Java language is built because it defines the shape and the nature of an object. As such, the class forms the basic for object-oriented programming in Java.

A class creates a new data type that can be used to create objects i.e., a class creates a logical framework which defines the relationship between its members. When you declare an object of a class, you are creating an instance of that class. Therefore, a class is a logical construct. An object has physical reality i.e., an object occupies space in memory.

Any concept you wish to implement in a Java program must be encapsulated within a class.

Classes in Java

A class in Java, can be defined as a template or blue print, describes the states or behaviours, that the objects or its type support. You will learn more about classes in separate chapter.

Objects in Java

Objects in Java, have states and behaviours. An object in Java, is an instance of a class. You will learn more about objects in separate chapter.


Every class in Java, has a constructor. If we do not explicitly write a constructor for a class, then the Java compiler builds the default constructor for the same class. You will learn more about constructors in separate chapter.

Create an Object

Since a class in Java, provides the blueprints for objects. Therefore an object is created from a class. You will learn more about creating objects in separate chapter.

Java Package

Package in Java, is a way of categorizing the classes and interfaces. When developing the Java applications, approximately about hundreds of classes and interfaces will be written, therefore categorizing these classes is must to make your program or software much easier. You will learn more about packages in separate chapter.

Import statements

Import statement in Java, is simply a way of giving the proper location for the compiler to find that particular class. You will learn more about importing packages in separate chapter.

Java Online Test

« Previous Tutorial Next Tutorial »

Follow/Like Us on Facebook

Subscribe Us on YouTube