January 2014
Intermediate to advanced
736 pages
70h 43m
English
A single statement can display multiple lines by using newline characters, which indicate to System.out’s print and println methods when to position the output cursor at the beginning of the next line in the command window. Like blank lines, space characters and tab characters, newline characters are white-space characters. The program in Fig. A.4 outputs four lines of text, using newline characters to determine when to begin each new line.
1 // Fig. A.4: Welcome3.java 2 // Printing multiple lines of text with a single statement. 3 4 public class Welcome3 5 { 6 // main method begins execution of Java application 7 public static void main( ...
Read now
Unlock full access