News for hackers. Stuff that matters.
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:28AM (#28985640)
OP meant the public static void main part (that is you define what happens encapsulated in a class) Of course implicit imports are needed, like what else would you have without?
Re:New language features since Java 8 to 17 by valenterry on Monday October 25, 2021 @04:44AM (#28985747)
> that is you define what happens encapsulated in a class

Apart from that it is really unintuitive to have something "static" within a class (which is commonly understand as a template), it is not encapsulated because it is static _and_ public. _And_ now you can search for this thing everywhere - and what happens if you find two of them?

Yeah no, the idea of "public static void main" wasn't a great one, no matter how I look at it.

It's much better to be explicit and ask the user to decide which file they want to use as the starting point.

> Of course implicit imports are needed, like what else would you have without

They are of course not needed. You could also just import everything manually. Okay, Java's import suck, but in a better language you could do "import prelude._" in the beginning of every file and otherwise you are left with keywords only. Not saying that's a great idea, but it certainly can work without implicit imports.