Forums Register Login

A static enumeration

+Pie Number of slices to send: Send
Hi,

The below code compiles fine even if the "static" keyword is removed for the enum declaration.



Can someone please explain?

Thanks.
1
+Pie Number of slices to send: Send
From the Java Language Specification:

Nested enum types are implicitly static. It is permissible to explicitly declare a nested enum type to be static.


So it doesn't matter if you declare it as static or not, it will be treated as if it was.
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 762 times.
Similar Threads
enum question from K&B
doubt in enums...anyone please help me out
Where are these methods documented
Enum Doubt
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:43:40.