Exercise 3-2 (Hello, world)
Chapter_3 Exercise_3-1 HelloDate | Exercise_3-3 |
Exercise 3-2 TIJ, p. 61
Exercise 3-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.
Hello.java
public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello, world!");
}
}
/*
javac Hello.java
java Hello
Hello, world!
*/
Chapter_3 Exercise_3-1 HelloDate | BACK_TO_TOP | Exercise_3-3 |
Comments
Post a Comment