Compile Crazy
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomePortalLatest imagesSearchRegisterLog in

 

 Hello, World! Java Tutorial

Go down 
AuthorMessage
The Fellow
Admin
The Fellow


Posts : 100
Join date : 2010-04-28
Age : 31
Location : In my head, dreaming up how to shake up the world

Hello, World! Java Tutorial Empty
PostSubject: Hello, World! Java Tutorial   Hello, World! Java Tutorial I_icon_minitimeMon Oct 25, 2010 2:59 pm

______________________________________________________________________________________
Hello, Java World!

The way to make a hello world program in java is fairly simple. Let me walk you through it.

First, we state the name of the class:
Code:

class HelloThar{
This tells the compiler that the class HelloThar starts there. If you are unsure what this whole class thing is, just think of it like a blue print of a object, with all information about it.

Then we give the code a main, just like in many languages:
Code:

public static void main(String[] args) {
There is a lot of gibberish in there, of which I will explain in a different tutorial. Just know that that lines starts the method main of the HelloThar class. If you do not know, a main is just what you probably can think of what it is; Everything being put into one place in a program.

Now we tell it to print, using the System.out class method println:
Code:

System.out.println("Hello, World!");
Always end a method call with a semi colon. If you are wondering about all those dots, it is because we are calling the System.out class so that we can use it to print. There is ways you can get around typing that whole line, but we will get into that later.

Finally end all your wrappings: first your main, then your class.
Code:
}
}

Now you have your first ever Java program, a simple hello world!
Back to top Go down
https://compilecrazy.forumotion.net
 
Hello, World! Java Tutorial
Back to top 
Page 1 of 1
 Similar topics
-
» What is Java?
» I am writing a Java book?
» Book Review: Head First Java
» Feeling drowned with all those Java Classes and methods?
» A better, and simpler Scar tutorial

Permissions in this forum:You cannot reply to topics in this forum
Compile Crazy :: Programming :: Java :: For Beginners-
Jump to: