HelloWorld Application

When you're learning a new programming language, it is often useful to jump in headfirst, learn how to write a short application, and then step back and learn the rest of the fundamentals. In this chapter, you do just that, and by the end you'll be able to write simple Java programs of your own.

Let's get started with an example application. Listing 2.1 shows the complete source code for the well-known HelloWorld program as written in Java.

Code Listing 2.1. The HelloWorld Application
/**
* My first program demonstrates displaying
* a string on the screen
*/
public class HelloWorld {
  public static void main(String args[]){  
  System.out.println("Hello World!");
  }
}

As you can see, there really isn't a lot to this program, ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.