Thursday, June 2, 2016

Hello World Java

Let's start learning Java with the most basic Java program. That of course is the Hello World program for Java.

To make life easier when testing simple Java code snippets, I've embedded a Java REPL in a page. Just follow the link above to the Java REPL. Also since Java 9, you can just use Java's built in REPL by typing 'jshell' from the command line.

Type the following command in the REPL.

System.out.println("Hello World!");

and then press enter. You will see the following.

Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_72 on Linux 3.13.0-49-generic
Welcome to JavaREPL Web Console version 302
java> System.out.println("Hello World!");
Hello World!

That's all there is to it! You've written your first Java code.

No comments:

Post a Comment