Home Segments Top Top Previous Next

62: Mainline

You can combine several separate variable declarations into one, more concise variable declaration if each variable has the same data type. In the following program fragment, for example, all three variables are declared to be integer variables in a single declaration:

public class Demonstrate { 
 public static void main (String argv[]) { 
  int script, acting, direction; 
  ... 
 } 
} 

Note the obligatory, variable-separating commas.