In Java, are enum types inside a class static?
Yes, nested enums are implicitly static.
From the language specification section 8.9:
Nested enum types are implicitly static. It is permissable to explicitly declare a nested enum type to be static.
It wouldn't make sense to make an instance-level (non-static) inner enum class - if the enum instances were themselves tied to the outer class they'd break the enum guarantee -
e.g. if you had
public class Foo {
private enum Bar {
A, B, C;
}
}
For the enum values to properly act as constants, (psuedocode, ignoring access restrictions)
Bar b1 = new Foo().A
Bar b2 = new Foo().A
b1 and b2 would have to be the same objects.