Do they have the equivalent of C# static classes in Java?

There are static members in Java classes, but no static class, like in C#.

The C# static class modifier doesn't really change anything about the class, from a usage standpoint, though. It just prevents you, at compile time, from adding instance variables.

You can make a class in Java that would work like a C# static class by just declaring every member as static. See the tutorial section on "Understanding Instance and Class Members" for details.


No. Just mark everything static. Possibly add a private constructor that throws an error and make the class final.

Tags:

C#

Java