Author: Shekhar Sharma

Aggregation in java

Aggregation in java

The most important advantage of Object oriented programming is code reusability. Aggregation means making a relationship or association between 2 classes. There is one directional association between the classes that represent Has-A relationship. As an example suppose,...

Inheritance in Java

Inheritance in Java

In java, Inheritance is a concept by which an object of child class can acquire all the methods and properties of the parent class. We use a keyword extends in class signature to acquire properties...

this keyword

this keyword

In java, this keyword is used as a reference of the current object. Here are few important usage of this keyword. this keyword represent current instance of the class. this can be used to call default constructor or...

Access modifiers

Access modifiers

In java, there are 4 types of access modifiers which are as follows. Public Private default protected We check their accessibility at 4 levels which are. Class level Subclass level Its own Package level...

Object class in java

Object class in java

The Object class, in the java.lang package, is the topmost class in java bydefault. In other words, it is the root of all the class hierarchy. You can use this class as reference of any...

Main method in java

Main method in java

In java, one might be wondering how to set a trigger point for execution  in an application. Answer would be you require to have a main method in your application. A main method signature is...

Static keyword

Static keyword

static  keyword s mainly used for memory management. It can be used with variables, method,blocks and  nested class. The static keyword belongs to the class, not to the object of the class. It can...

Constructor in java

Constructor in java

Constructor is an interesting concept in java. A constructor is used to initialize the object. In other words, a constructor is invoked when we create any object.A constructor initializes the data for the object. Rules...

Packages

Packages

Package in java is nothing but a kind of directory which contains a group of similar types of classes, interfaces and subpackages. Packages can be created by right click on the src folder and select...

Methods and return value

Methods and return value

Programming is considered good if it contains reusable components. By making reusable components, there will be less no. of line of code, code will look better, you don’t have to write the same functionality...