Hello World Program in Java

To write a simple program in Java that prints “Hello World” on console, follow the following steps:

  1. Make a public class named Application.
  2. Define a main function in it.
public static void main(String args[]) 
{
}

Make sure method signature should be same as above, otherwise it will give error at run time.

3. Display the text “Hello World” using println().

System.out.println("Hello World");

And you are done.

Here is the full source code.

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

About Priyanka Kapoor

Simple, Hardworking & friendly.....
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s