Java Reference
In-Depth Information
args){// Display a greeting in the console window
System.out.println("Hello, World!");}}
You can even write every word and symbol on a separate line,
public
class
HelloPrinter
{
public
static
void
main
(
. . .
17
18
However, good taste dictates that you lay out your programs in a readable fashion. We
will give you recommendations for good layout throughout this topic. Appendix A
contains a summary of our recommendations.
Lay out your programs so that they are easy to read.
When you run the test program, the message
Hello, World!
will appear somewhere on the screen (see Figures 10 and 11 ). The exact location
depends on your programming environment.
Now that you have seen the program working, it is time to understand its makeup. The
first line,
public class HelloPrinter
starts a new class. Classes are a fundamental concept in Java, and you will begin to
study them in Chapter 2 . In Java, every program consists of one or more classes.
Classes are the fundamental building blocks of Java programs.
The keyword public denotes that the class is usable by the Ȓpublicȓ. You will later
encounter private features. At this point, you should simply regard the
Search WWH ::




Custom Search