Java 10 (JDK 10) was released on March 20, 2018, so let's try Hello World.

Install Java SE Development Kit 10 on macOS Sierra

From Java SE Development Kit 10 --Downloads, the installer for the JDK for macOS jdk-10_osx-x64_bin Download .dmg.

java10_01.png

Open jdk-10_osx-x64_bin.dmg. Double click to install.

java10_02.png

Requires 700MB or more free space.

java10_03.png

Confirm that the installation was successful.

$ java -version
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)

$ javac -version
javac 10

Try Hello World

Sample code HelloWorld.java is prepared to use the type inference (JEP 286: Local \ -Variable Type Inference) that seems to have been introduced in Java 10. Declare the variable message, which is known to contain the String type, with var.

public class HelloWorld {

  public static void main(String[] args) {
    var message = args[0];
    System.out.println(message);
  }
}

compile.

$ javac HelloWorld.java 

Run. It worked as expected.

$ java HelloWorld "hello, world"
hello, world

Reference material

Recommended Posts

Java 10 (JDK 10) was released on March 20, 2018, so let's try Hello World.
Try Hello World using plain Java on a Docker container
Hello World on AWS Lambda + Java
Hello World on Mac VS Code Java
Java, Hello, world!
Java Hello World
"Hello World" in Java
Java Learning (1)-Hello World
Let's write Hello World
Hello World in Java
Hello World on WebAssembly
The Records that are preview released in JDK 14 are nice, so let's try it with JShell
java hello world, compile, run
Java beginners read Hello World
Try Hello World with the minimum configuration of Heroku Java spring-boot
OpenJDK 11 and Oracle JDK 11 have been released, so try diffing them.
Hello World for ImageJ Java Plugin
Install Java Open JDK 8 on CentOS 7
Hello World in java in eclipse now
Hello world in Java and Gradle