Category Java

Static Nested Class in Java

Accessing static and non-static members from static and non-static nested class

When an inner class is defined with a static modifier inside the body of another class, it is known as a static nested class in Java. A static nested class is also considered a top-level class, nested top-level class, or…

Anonymous Inner Class in Java

Anonymous inner class in Java

An anonymous inner class in Java is a type of an inner class which is declared without any class name at all. In other words, a nameless inner class is called anonymous inner class. Java anonymous inner classes are useful…

Method Local Inner Class in Java

Method local inner class in Java

An inner class that is declared inside a method of the outer class is called method local inner class in Java. Its scope is limited to the block of a method in which it is declared. Therefore, the declaration of method…

Member Inner Class in Java with Example

A non-static class that is declared inside a class but outside the method is known as member inner class in Java. It is also known as regular inner class. It can be declared with access modifiers like public, default, private,…

Packages in Java with Example Program

Predefined Packages in Java

In this tutorial, we are going to discuss packages in Java with the help of example programs. In small projects, all the Java files have unique names. So, it is not difficult to put them in a single folder. But,…