Home Segments Top Top Previous Next

48: Mainline

Spaces, tabs, line feeds, and carriage returns are said to be whitespace characters. Java is blank insensitive: It treats all sequences of whitespace characters—other than those in strings—as though there were just a single space. Thus, the following are equivalent:

public class Demonstrate { 
 public static void main (String argv[]) { 
  System.out.print("The rating of the movie is "); 
  System.out.println(6 + 9 + 8); 
 } 
} 

public class Demonstrate 
{ 
public static void main (String argv[])  

{ 
        System.out.print("The rating of the movie is "); 
        System.out.println(6 + 9 + 8); 
} 

} 

Neither of these layout options is “better” or “official.” In fact, many experienced Java programmers argue heatedly about how to arrange methods to maximize transparency and to be most pleasing to the eye. In this book, the methods are written in a style that both uses paper efficiently and lies within the envelope of common practice.