First, nested class
Using nested classes reduces naming conflicts , and an inner class can be defined in a class , in a method , or even in an expression .
(1) Definition: A nested (nested) class is any class whose declaration occurs within the body of another class or interface.
(2) Nested classes are divided into two types: static nested classes and non-static nested classes, and non-static nested classes are inner classes (inner Class).
The inner class is divided into four types:
Static Nested Classes (Static nested classes)
member Inner class (Member inner classes)
local inner class (Local inner classes)
Anonymous Inner class (Anonymous inner classes)
Second, Static nesting class
A static class, the simplest nested class, can only access static member variables and static methods of external classes .
1. Static classes cannot access non-static members of external classes and non-static methods (whether public or private);
2, the static class instance does not need to instantiate the Barbarian member first, can instantiate directly.
Public class outer{ publicstaticclass nestedclass{ }}
Java Nested classes