Comment by kasperni

1 day ago

For Java 25 which is planned to be released in a couple of weeks:

----- https://openjdk.org/jeps/512 -----

First, we allow main methods to omit the infamous boilerplate of public static void main(String[] args), which simplifies the Hello, World! program to:

  class HelloWorld {
    void main() {
      System.out.println("Hello, World!");
    }
  }

Second, we introduce a compact form of source file that lets developers get straight to the code, without a superfluous class declaration:

  void main() {
    System.out.println("Hello, World!"); 
  }

Third, we add a new class in the java.lang package that provides basic line-oriented I/O methods for beginners, thereby replacing the mysterious System.out.println with a simpler form:

  void main() {
    IO.println("Hello, World!");
  }

so getting closer to Go's syntax, n'en déplaise à certains, apparently. :-)

  • Except for the extra 3 lines of if err for every statement..

    • Perhaps that it is coming sooner than you think... It all started with adding Value types, now syntactic refinements à la Go... Who knows? :-) You'll be very happy.

      edit: hold on wait, java doesn't have Value types yet... /jk

      3 replies →