Search code examples
javac#enumsheap-memorystack-memory

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


Solution

  • 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.