Java Reference
In-Depth Information
28 System.out.println("| |");
29 System.out.println("+------+");
30 System.out.println(" /\\");
31 System.out.println(" / \\");
32 System.out.println(" / \\");
33 }
34 }
The following is the output the program generates. Notice that the program
includes double backslash characters ( \\ ), but the output has single backslash charac-
ters. This is an example of an escape sequence, as described previously.
/\
/ \
/ \
\ /
\ /
\/
\ /
\ /
\/
/\
/ \
/ \
/\
/ \
/ \
+------+
| |
| |
+------+
|United|
|States|
+------+
| |
| |
+------+
/\
/ \
/ \
Comments and Readability
Java is a free-format language. This means you can put in as many or as few spaces and
blank lines as you like, as long as you put at least one space or other punctuation mark
between words. However, you should bear in mind that the layout of a program can
enhance (or detract from) its readability. The following program is legal but hard to read:
1 public class Ugly{ public static void main(String[] args)
2 {System.out.println("How short I am!");}}
 
Search WWH ::




Custom Search