Java (Programming Language) for Beginners


Introduction: Java (Programming Language) for Beginners

About: I am a High School student in Cairns, Queensland. Most of the time I am either at school, doing stuff on my computer or working on the coolest OS system ever: Saerox. Saerox is owned and run by a fellow I...

This Instructable will show you the wonders of Java (programming language). You will also be able to DIY (Do It Yourself) at home. There is no cost involved within this Instructable. It's very easy, and requires no other programming language at all.

I have spread the main part over steps 3-5. Simply beacuse there is quite a lot of information.

Please rate this Instructable and leave comments, questions or statements. All questions, statements, and comments will be answered.

Step 1: What Is Java?

Java is just one of the hundreds of different programming languages in the world. Java language is an object-orientated programming language which was developed by Sun Microsystems. Java programmes are platform independent which means they can be run on any operating system with any type of processor as long as the Java interpreter is available on that system.

Step 2: What You Will Need

You will need the Java Software Development Kit from Sun's Java site. Follow the instructions on Sun's website to install it. Make sure that you add the java bin directory to your PATH environment variable. To find the Java Software Development Kit, go to the top right-hand corner of the screen and you will see a search bar. Type in: Java Software Development Kit. The the search results appear, find the one that says something along the lines of download.

Step 3: Writing Your First Java Programme:Part 1

You will need to write your Java programs using a text editor. When you type the examples that follow you must make sure that you use capital and small letters in the right places because Java is case sensitive. The first line you must type is:

public class Hello

This creates a class called Hello. All class names must start with a capital letter. The main part of the program must go between curly brackets after the class declaration. The curly brackets are used to group together everything inside them.

public class Hello


Step 4: Writing Your First Java Programme:Part 2

We must now create the main method which is the section that a program starts.

public class Hello
public static void main(String[] args)


You will see that the main method code has been moved over a few spaces from the left. This is called indentation and is used to make a program easier to read and understand.

Here is how you print the words Hello World on the screen:

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

Step 5: Writing Your First Java Programme:Part 3

Make sure that you use a capital S in System because it is the name of a class. println is a method that prints the words that you put between the brackets after it on the screen. When you work with letters like in Hello World you must always put them between quotes. The semi-colon is used to show that it is the end of your line of code. You must put semi-colons after every line like this.

Step 6: Compiling the Programme

What we have just finished typing is called the source code. You must save the source code with the file name before you can compile it. The file name must always be the same as the class name.

Make sure you have a command prompt open and then enter the following:


If you did everything right then you will see no errors messages and your program will be compiled. If you get errors then go through this lesson again and see where your mistake is.

Step 7: Running the Programme

Once your program has been compiled you will get a file called Hello.class. This is not like normal programs that you just type the name to run but it is actually a file containing the Java bytecode that is run by the Java interpreter. To run your program with the Java interpeter use the following command:

java Hello

Do not add .class on to the end of Hello. You will now see the following output on the screen:

Hello World

Congratulations! You have just made your first Java program.



    • Creative Misuse Contest

      Creative Misuse Contest
    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest

    11 Discussions

    um so I was wondering can u program like your own game with this Java stuff cause I'd like to do that I no Minecraft is based on Java: and was wondering?

    I'd suggest NetBeans mainly because by default it generates projects that can be easily compiled anywhere outside the IDE using Ant (instead of Eclipse's just calling the compiler directly) And the last 5 images need to be seriously rethought.

    Does it matter if i download java 2 software development kit? are they the same thing?

    This might be useful as notes for someone who has taken a class on Java, but as a stand alone work? Not useful. To many presumptions, no definitions, no why something works, no alternatives to make something work... This is 'how to write hello world', not 'java for beginners'.

    1 reply