Hello World in Java

Tutorial Difficulty Level    

This is how you would display “Hello World” in your Java application.

We break the process of programming in Java into three steps:

  • Create the program by typing it into a text editor and saving it to a file named, say, HelloWorld.java.
  • Compile it by typing “javac HelloWorld.java” in the terminal window.
  • Execute (or run) it by typing “java HelloWorld” in the terminal window.

So, the code in our file would look like

To compile HelloWorld.java type the text below at the terminal

Once you compile your program, you can execute it. This is the exciting part, where the computer follows your instructions. To run the HelloWorld program, type the following in the terminal window:

That’s it!