Static Classes In Java

后端 未结 13 1865
慢半拍i
慢半拍i 2020-11-22 07:37

Is there anything like static class in java?

What is the meaning of such a class. Do all the methods of the static class need to be static

13条回答
  •  星月不相逢
    2020-11-22 08:17

    Well, Java has "static nested classes", but they're not at all the same as C#'s static classes, if that's where you were coming from. A static nested class is just one which doesn't implicitly have a reference to an instance of the outer class.

    Static nested classes can have instance methods and static methods.

    There's no such thing as a top-level static class in Java.

提交回复
热议问题