Skip to content
Advertisement

Java’s enum… Where are they created?

Since enum in C# are on the stack, I was wondering where enum, in Java, where created. On the stack? On the heap? In some mysterious other place?

Enumeration in C# are more primitive than those in Java, this might explain why they are created on the stack…

Where are they? I can’t find them!

Thanks

Advertisement

Answer

Enums in Java are also objects: for example, enums can have instance variables/methods/constructors and implement interfaces. All this makes me think they’re handled just like other objects by jvm.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement