O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

  1. Let's execute a series of code snippets, as follows:
        "Hello World"        String msg = "Hello, %s. Good Morning"        System.out.println(String.format(msg, "Friend"))        int someInt = 10        boolean someBool = false        if ( someBool ) {          System.out.println("True block executed");        }        if ( someBool ) {          System.out.println("True block executed");        }else{          System.out.println("False block executed");        }        for ( int i = 0; i < 10; i++ ){          System.out.println("I is : " + i );        }
  1. Save the code snippets executed into a file called history using the /save history command.
  2. Exit the shell using /exit and list the files in the directory by using dir or ls, depending ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required