News for hackers. Stuff that matters.
Re:Java 22 Released by lotsoweiners on Tuesday March 19, 2024 @03:15PM (#39759248)
That sounds a lot like Top-level Statements in the .Net world. Personally I don’t use that feature because I’m old and get confused if things are magic but can certainly see the benefit for the newer devs.
Re:Java 22 Released by starik36 on Tuesday March 19, 2024 @03:21PM (#39759303)
Yeah, no doubt inspired by the .NET feature. I use it all the time for throwaway console apps.
Re:Java 22 Released by jonathanlydall on Wednesday March 20, 2024 @09:30AM (#39766200)
I’m also a somewhat old school C# dev and the main reason I don’t use top level statements is that they only work in a single file of an application, so that single file is different from every other file in your solution.

It’s okay if you’re only writing a single file, and it really seems intended for beginners or micro applications, but for those of us writing anything besides the most trivial, it’s merely “cute” and just adds inconsistency.