Why Nested Classes in Java

Introduction to and motivation for using nested classes in Java

Vinicius Monteiro
Programming For Beginners
2 min readJul 15, 2022

--

Image by Sasin Tipchai from Pixabay

Nested classes, as the name suggests, are classes defined inside another class. They can be of two types,

  • Static. Known as nested static classes. They can’t access members of the outer class.
  • Non-static. Known as inner classes. They can access members of the…

--

--