Minecraft Blogs / Tutorial

Java Programming Tutorial #2 - Hello World

  • 1,529 views, 1 today
  • 5
  • 3
  • 1
SourC00kie's Avatar SourC00kie
Retired Moderator
Level 45 : Master Blob
200
Click here to see Java Programming Tutorial #1 - Installing JDK and Eclipse

Click here to see Java Programming Tutorial #3 - Variables

Creating A Java Project:


The first step you need to do is to create a Java Project. This is very easy. All you need to do is click 'File' in the upper right hand corner, click on 'New' and the first thing you will see is, 'Java Project'. Click that and then call it whatever you want, I called mine, Test.

Creating Classes Inside Your Project:

You will have two types of classes in side your project, a main class and sub-classes. Right now, you just need to focus on your main class. To create a class for your project, just right click the project, click on 'New' and then click on Class as shown in the picture below.

javatutzpng

Once again, you can call it whatever you want.

Hello World:

Now it's finally time to create your first Java Application! Like I said before, you will need a main class. To make the class you just create the main one, follow these instructions:

class test {
public static void main(String args[]) { (This is the line that shows which class is the main method)
System.out.println("Hello World"); (This is what the console reads and shows)
}
}

Now just click, 'Run' in the upper left hand corner and in the bottom of Eclipse you will see, Hello World.

You did it! You just created your first Java Application. Now this is where it gets trickier and more fun so stay tuned for more tutorials later on! Thanks for reading.
Tags

Create an account or sign in to comment.

Tarka
12/04/2011 8:52 pm
Level 39 : Artisan Architect
Tarka's Avatar
Gonna try this out tomorrow :P
1

Welcome