Re:Java in the Small
by almostgotcaught on Thursday December 19, 2024 @12:38AM
(#42458725)
> It's implicitly still a class, you just don't need to write all the scaffolding to indicate that.
did you know that every function in a python script is actually an attribute of that module (which is basically a class). so my point is: who cares.
Re:Java in the Small
by imtringued on Thursday December 19, 2024 @08:35AM
(#42461235)
geokon's point still stands. This is meaningless syntax sugar that does not change anything fundamental about Java except add one more special rule into the language aka it is one more thing to learn. Rather than being helpful, it just becomes friction when an old developer uses the old method and a new developer uses the new method.
You still need to know what a main class is, so that you can reference it in your build.gradle file.
If you're using a build.gradle file then you probably won't see any benefit to this implicit class, yes.
But it's useful for little one-off scripts, where you just go `$ java foo.java` from the command line.
But, yes, with static imports, you can just write "println" like that and have it work.