Thinking in Java Fourth Edition Bruce Eckel Chapter 1 Exercise 2

Exercise 2:  (1) Following the HelloDate.java example in this chapter, create a “hello,world” program that simply displays that statement. You need only a single method in your class (the “main” one that gets executed when the program starts). Remember to make it static and to include the argument list,  even though you don’t use the argument list. Compile the program with javac and run it using java . If you are using a different development environment than the JDK, learn how to compile and run programs in that environment.

Solution:

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

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *