This is a preview feature that still requires the --enable-preview flag. It's meant to reduce the initial cognitive load when teaching programming rather than an embrace of terse syntax.
This is a preview feature that still requires the --enable-preview flag. It's meant to reduce the initial cognitive load when teaching programming rather than an embrace of terse syntax.
I assumed they were just making any method called 'main' sugar for public static void.
But it's not that way. Instead, apparently the proposal is to allow for main to be an instance method.
Additionally, we are getting anonymous classes.
Because methods can share names (both between inheritance and with different args) we apparently get a warning if a superclass also has a static main being overridden with an instance main. I would have preferred if this was simply an error.
An instance method of... which instance? Is some invisible, nameless class instantiated with its default constructor? How would you acquire this main method via reflection?
You won’t acquire this main via reflection because why would you do so? It is for teaching, and one-off scripts. Later on you can trivially add that single line and name your class.