Displaying "Hello World"

Open your JCreators (or whatever you are using), and create a new file or project.


Note that whatever the name of your project is, that should be the same name of your class (to be discussed in a short while). Also take note that Java is case sensitive which means Int and int are different.

After setting up your project, you will now see your workspace (where you'll type in the codes).
Our aim today is to display the string Hello World to your screens upon executing your program. So here's the code you have to type in:


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


So as you have noticed, every statement in Java should end with an ;

Also, take note that public should always be lowercased while String and System should be written with a capital S.

System.out.println can also be written as System.out.print. Try it yourself!

No comments:

Post a Comment

Extended Search

Custom Search
Hello World