Creating and Using Objects

Class is a collection of different types of data elements and their associated behaviors and methods. The keyword ‘new’ is used to allocate space in the memory to store data. The constructor is used to initialise the class object. A constructor in a class is a special type of method called at the creation of an object. It is called a constructor because it constructs the values of data members of the class. They have same name as a class without any access modifier. Parameterised constructor contains arguments to assign a value to the class elements. Objects are the basic run-time entities in an object oriented system. Every object is associated with data and functions that define meaningful operations on that object.

Java provides four types of access specifiers public, private, default and protected. The purpose of access specifiers is to declare which entity cannot be accessed from where.

To Access the full content, Please Purchase