FANDOM



Your First Java Program

Here you will learn how to create your first Java program that will print the text

    "Hello World"

Create the following file in a text editor, such as notepad. Do not use an office text editor, such as word.

Add the following text to your file:

     public class first{
            public static void main(String[]args){
            System.out.println("Hello World");
         }
     }


Don't worry what this means, we'll go over it later.

Make sure that a Java complier is installed on your PC.

Save this as "first.txt", open a command prompt, and type

     javac first.java

Then type

     java first

With any luck, you will see the following text:

    Hello World.

Congratulations!

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.