Java - Hello World!

by WillH112 in Circuits > Software

258 Views, 1 Favorites, 0 Comments

Java - Hello World!

hello-world.png

The first step in learning any programming language is to have it print out "Hello World!" This instructable will take you through all the necessary steps to print out hello world in java.

Download Java

java.jpg

Download Java from Java's official website.

Choosing an IDE

IntelliJ.png

To program Java all you really need is a simple text editor such as notepad, but nobody wants to torture themselves like that. There are various Integrated development environments (IDE) that can be used to program java that offer many features such as automatic compiling and error recognition. Pictured above is Intellij by jet brains. It is considered to be the best Java IDE, but it is expensive. For this instructable I will be using Eclipse which is a free alternative.

Create New Project

Screenshot (2).png

Click on the create new project button and select new java project. You can input the version of java that you want. I am using java version 1.8. Name the project whatever you want. I named mine Hello World. When you're satisfied with the options create the new project.

Create New Class

Screenshot (3).png

All code in java is written in a class. Create on by clicking on the create class button in the top row. Be sure to check the public static void main option. If you don't its not a big deal. just copy the function below inside the class curly brackets.

public static void main(String[] args) {
// TODO Auto-generated method stub

}

Type Code

Screenshot (4).png

Inside the public static void main function type

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

You can put anything you want in the quotation marks. To run the code click on the play button in the top row next to the other options.