13/01/2014
Aloha!!! Welcome to our second Java tutorial, we are going to write our first program, before we do that, lets create a directory/folder where we will keep our files,
how to create directory/folder using Command Prompt
Open Command Prompt and type cd \ and press enter
this will take it back to your local disk
Now create a directory by typing
Mkdir nameofthefolder and press enter
Go to your local disk to confirm if the directory has been created or type dir to check from command prompt.
Now open notepad++ or jcreator, notepad++ and jcreator is one of my favorite editor, you can use anyone of your choice, including notepad etc.
The notepad++ can be downloaded from http://notepad-plus-plus.org/
After installing, open notepad++
Go to file, save as, now locate the folder that was created.
And save the file with any name you want, for this example we are using
Studentofnaija
and change the save as type to java source type (*.java)
Now we have a file called Studentofnaija.java
Please note: in this tutorial am only showing you how to run a program, in the next tutorial I will explain what everything means in the program in detail
For beginners please follow me
//CODE
//in java everything begins with a class, without the class you can’t do anything, the keyword class is used to specified that we are defining a class, note the name of the class is spelt the same way as the name of the file, it is case sensitive
//as shown above, a class has been created called studentofnaija
//inside this class we are going to use what we call a method, a method is simply a list of things to do
//before your computer runs a program, it looks for a method called main
//all java program begins with a method called main, without the main method, the java application wont run
Declaring this method as public means that, it is accessible from outside the class, so that the JVM can find it
Declaring the method as static means that the method exist as part of class definition as a form that is ready to be executed
//Now let’s give the computer the instruction we want to output
below is the cold, copy and paste it on your editor
click on the link for the complete tutorial. http://studentofnaija.com/forum/index.php/topic,16.0.html