r/java • u/RevilTS • Aug 03 '25
Teach Me the Craziest, Most Useful Java Features — NOT the Basic Stuff
I want to know the WILD, INSANELY PRACTICAL, "how the hell did I not know this earlier?" kind of Java stuff that only real devs who've been through production hell know.
Like I didn't know about modules recently
393
Upvotes
View all comments
Show parent comment
4
u/Polygnom Aug 03 '25
I said "kinda" for a reason. You get a couple things with sealed types you dont get with enzms and vice versa. Biggest advantage of sealed types is that you can restrict the subset of allowed values, which you cannot with enums (there is an old JEP forcenhanced enums that would allow this, but it sees little traction).