Inner Classes & Nested Classes Java

As per java documentation
  • An inner class is a non static class declared inside another class.
  • A nested class is a static class declared inside another class, Even though it is declared inside another class, it won't be considered as an inner class.
Some tricky points to remember:
  • It is a compile-time error if an inner class declares a member that is explicitly or implicitly static, unless the member is a constant variable. A constant variable is a final variable of primitive type or type "String" that is initialized with a constant expression.