Advantages and Disadvantages of Inheritance in Java

Inheritance is one of the pillars of the Java programming language. Learning OOP (Object Oriented Programming) without knowing and understanding the concept of Inheritance, its pros and cons are incomplete. Inheritance is a process in which a class acquires all the data members and its parent class methods. The basic idea behind it is that …

Advantages and Disadvantages of Inheritance in Java Read More »

Basic Structure of Java Program with Example

Java is a very popular language and used on 7 billion devices worldwide. It is one of the most secured, platform-independent, and object oriented programming languages that’s why it is necessary to be familiar with the basic structure of Java program. A typical Java program consists of the following sections: Package statements Documentation Section Import …

Basic Structure of Java Program with Example Read More »

Difference between Constructor and Method in Java

Java is an Object-Oriented Programming language. Therefore, the data and the member functions in Java are present in the classes. The classes in Java contain both constructors and methods as well. Let’s see in detail about methods and constructors and their differences. Constructor The purpose of constructors is to initialize the objects, which are the …

Difference between Constructor and Method in Java Read More »

What is the Purpose of Default Constructor in Java

In object-orientated programming, the constructor plays an important role. A constructor is similar to the member functions of the class. However, their signature and purpose differ. The constructors have no return type, unlike the methods. Also, the constructor name always matches with the class, which makes it easily identifiable. In general, there are three types …

What is the Purpose of Default Constructor in Java Read More »