Java #1

08Dec07

Right to start writing Java programs you need to download the Java Software Development Kit (SDK) from here at the sun.com site. Once you have that done you may what to use an IDE, one good one for Java is JCreator, you can use it for free.

Now open up the IDE/Text Editor and enter the following for the Basic Hello World Example!

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

The first starts the public class.

The second line calles the main method. Like C++ the main method is what gets called first when the program is run, so this allways needs to be there unless you are writing a class file (I think)

The third line is used to print messages to the screen. There are two ways to do this, one is like the above. and the other is:

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

This way with just the print, makes the curser not return. erm I’ll upload some pictures later, but when you run it you’ll understand.

Hope this helped and Questions just ask.

If you liked this and are a nice person would you like to donate to my Stargate fund?



No Responses to “Java #1”  

  1. No Comments

Leave a Reply




    HI, I'm Pete. I'm studying HND Computing and I'm trying to buy Stargate SG-1 Seasons 1 - 10 box set. I'm hoping that if I write lots of really useful information that some nice people might donate some money to me so I can buy all of the Stargate Seasons