Java Encapsulation: The Complete Guide

Java Encapsulation Encapsulation is one of the four fundamental (inheritance, abstraction, and polymorphism) Object-Oriented Programming concepts. It a kind of mechanism of wrapping data in a single unit. In encapsulation variables of a class are kept hidden from other classes. We use access specifier to make these data private, protected (To make variable private in … Read more

Java Abstract Class: The Complete Guide

Java abstract class that is declared using the “abstract” keyword is known as an abstract class. This is because, in C++ programming language, we need to declare a pure virtual function in that class to make a class abstract. But in Java, it’s different. To build a virtual class, there should have at least one abstract … Read more

Java Inner Class: The Complete Guide

Classes in Java can have another class inside them, and they are known as nested classes. A nested class is a class inside another class called an enclosing class. The scope of the nested class is until the scope of its enclosing class. That means a nested class cannot work independently of its enclosing class. … Read more

Java Static Class: The Complete Guide

Java static class is always implemented in the nested inner class. Suppose there are two classes, outer and inner, in which inner is the nested class. Then static can be given to the inner class only. The benefit of the static class is we didn’t create an object for a static class in the main … Read more

Java ArrayList: The Complete Guide

ArrayList is part of the collection framework and is present in java.util package. ArrayList inherits the AbstractList class and implements the List interface. Java ArrayList Java ArrayList is a part of a built-in collection framework used to save the dynamically sized collection of elements. Arrays are fixed in size; an ArrayList grows its size automatically … Read more

Method Overriding in Java: The Complete Guide

In any object-oriented programming language, Overriding is the feature that allows a subclass or child class to provide a specific implementation of the method that is already provided by one of its superclasses or parent classes. Method Overriding in Java Method overriding in Java can be defined as a method in a subclass or child … Read more

Multithreading in Java: The Complete Guide

Usually, in a standard Java program, the entire program runs as a single “thread.” What it means that if a part of the program is demanding some I/O resource, for example, to proceed further, and if that I/O resource is not available at the moment, the entire program will be waiting and won’t also execute … Read more

Runnable Interface in Java: The Complete Guide

In Java, the concept of multiple inheritance is possible only through the interface. The interface is a collection of abstracts (standard method not present). Unless the class that implements the interface is abstract, all the interface methods need to be defined in the class. A class implements an interface using the keyword implements. Runnable interface … Read more

Java Interface: The Complete Guide

Java Interface is similar to a class capable of handling multiple inheritance. However, Java Interfaces do not have a body; the class must implement them before you can access them. Why use the interface in Java The class that implements the interface must implement all the methods of that interface. Also, the Java programming language … Read more

Java Constructor: The Complete Guide

We can say a Constructor is a particular type of method by which we can initialize the object of the class. It constructs the values at the time of a creation of an object. That’s why it is called the Constructor. It is not mandatory to create the Constructor for a class because the compile-time … Read more