Can internal Classes define static data or methods in their visible domains? The answer is no. Why? Think about it. static data and methods are called class data and class methods. Why? Because they are an integral part of a class and are equivalent to a method at a level, internal classes cannot possess static data and methods, just as the method cannot have static. But Nested classes can. What is a nested class? A nested class is an internal class with static modification. The behavior of the nested class is very different from that of the internal class. It is basically different from that of the internal class, it is an internal class, so the nested class can indeed be called an internal class. The biggest difference between Nested classes is that they are not referenced by peripheral classes! When talking about static, we have said that static does not need to be associated with a specific class object. Therefore, you can directly create Nested classes without creating external class objects, naturally, the reference of the peripheral class is lost. So why do we need Nested classes? A very important application is to use Nested classes in interfaces. Many people may wonder why Nested classes can be placed in interfaces? The methods in the interface are not implemented in detail, but the nested classes are different. They can have specific implementations. Code . But this is actually not a conflict. Any class in the interface is public and static, and the nested class itself meets such requirements, so it does not violate the interface naming rules. So why should we place Nested classes in interfaces? Because Nested classes can have their own specific implementations, or even implement external interfaces, and these can be used by the classes that implement this interface, the role of Nested classes is also desired. If you want some public code to be shared by different implementations of the interface, you can use Nested classes in the interface. For example, we all want to test the classes we designed when creating classes. One way is to put the main () method in each class we designed, however, this method will be re-compiled every time a class instance is created, so it is not appropriate to put the main () method in a nested class, there is no such concern, because we all know that static is only compiled once. This is also a good use case for nested classes.