Java Tutorial For Beginners


If just hearing the word "programming" conjures images of a lot of boring syntax that no normal person could understand, relax—we've put together an easy-to-follow Java tutorial for beginners just for you. As you may or may not know, Java is a type of object oriented programming language that is used by many programs and websites for visual and operational enhancements. In English that basically means that Java is the code behind those little pop-ups, menus and what-nots that make a particular user interface more interactive and enjoyable. Now, a disclaimer—for some, yes, programming can be difficult to grasp. But don't let that discourage you. Rome may not have been built in a day, but your first Java script program sure will be.

To get started, you're going to need a few things.

  • Internet access (to download)
  • current Java SE Development Kit (JDK)
  • text editor/text editing software

All programming students will take their first steps in creating the "Hello World" program. Again, it's helpful if you have a bit of programming knowledge to start, but like a Java tutorial for beginners, you can find many other programming tutorials that can walk you through the languages and processes

  1. First you will need to download the latest version of the Java SE Development Kit or JDK. This can easily be obtained from the Sun Microsystems website. You'll need to download this in order to get started; while you're here, if you haven't updated your own Java platform, you should do that too.
  2. Next, open your text editor. For most people, this is going to be Windows Notepad, but if you're using a different operating system, use that system's text editor. You can also download a text editor in the case that your OS didn't come with one. 
  3. In NotePad, you're going to be creating the source code for the Hello World program. You'll need to type out the following sequence: /**  * The HelloWorldApp class implements an application that  * simply prints "Hello World!" to standard output.  */ class HelloWorldApp {     public static void main(String[] args) {         System.out.println("Hello World!"); // Display the string.     } }
  4. Save this as "", including the quotations. You should save this within the Java folder that was created when you downloaded the JDK. This is usually C:\java. Remember that in code, elements are case sensitive, so if you have typed lower case "hello world", you will need to keep that format throughout as to not encounter any errors.
  5. After you have saved your app, close your text editor and open up a command prompt. This is easily done by going to START and then selecting RUN and typing in cmd. Once the command prompt is open, you will need to change your current directory folder (which is usually documents and settings) to that of your Java folder. To change directories, type cd C:\java. You will then be in the java folder.
  6. You will need to create a Java class, which is easily done by typing javac in the command prompt and hit ENTER. This will create the class that you need to run the program.
  7. To run your Java program, type in java HelloWorldApp and hit the ENTER key. You should now see the text, "Hello World!".

Congrats! You've just written your first program in Java. Not so hard, right? If you're hungry for more, Sun Microsystems has their own set of materials that you can go through to learn more about the programming language and even more programs to complete. Remember, as with all things, you're not going to get better unless you practice, practice, practice. So, what're you waiting for? Go program something worthy of Mordor already!

show comments

What Others Are Reading Right Now.