The use of private constructor is to serve singleton classes. A singleton class is one which limits the number of objects creation to one. Using… [Read More]
Multilevel inheritance in java with example
When a class extends a class, which extends anther class then this is called multilevel inheritance. For example class C extends class B and class… [Read More]
Hierarchical Inheritance in java with example program
When more than one classes inherit a same class then this is called hierarchical inheritance. For example class B, C and D extends a same… [Read More]
hybrid inheritance in java with example program
A hybrid inheritance is a combination of more than one types of inheritance. For example when class A and B extends class C & another… [Read More]
Constructor Overloading in Java with examples
Like methods, constructors can also be overloaded. In this guide we will see Constructor overloading with the help of examples. Before we proceed further let’s… [Read More]
Method Overloading in Java with examples
Method Overloading is a feature that allows a class to have multiple methods with the same name but with different number, sequence or type of… [Read More]
Interface in java with example programs
In the last tutorial we discussed abstract class which is used for achieving partial abstraction. Unlike abstract class an interface is used for full abstraction…. [Read More]
Abstract Class in Java with example
A class that is declared using “abstract” keyword is known as abstract class. It can have abstract methods(methods without body) as well as concrete methods… [Read More]
Inner classes in java: Anonymous inner and static nested class
What is an inner class? Inner class are defined inside the body of another class (known as outer class). These classes can have access modifier… [Read More]
Java static import with example
Static import allows you to access the static member of a class directly without using the fully qualified name. To understand this topic, you should… [Read More]
Java static constructor – Is it really Possible to have them in Java?
Have you heard of static constructor in Java? I guess yes but the fact is that they are not allowed in Java. A constructor can not… [Read More]
Java – static variable with example
A static variable is common to all the instances (or objects) of the class because it is a class level variable. In other words you… [Read More]
Difference between static and non-static members in Java
Java is a Object Oriented Programming(OOP) language, which is often interpreted that we need objects to access methods and variables of a class, however this… [Read More]
Difference Between Abstract Class and Interface in Java
In this article, we will discuss the difference between Abstract Class and Interface in Java with examples. I have covered the abstract class and interface in… [Read More]
Java Access Modifiers – Public, Private, Protected & Default
You must have seen public, private and protected keywords while practising java programs, these are called access modifiers. An access modifier restricts the access of… [Read More]