A.3. Modifying Your First Java Program

Welcome to Java Programming! can be displayed several ways. Class Welcome2, shown in Fig. A.3, uses two statements (lines 9–10) to produce the output shown in Fig. A.1.

 1   // Fig. A.3: Welcome2.java 2   // Printing a line of text with multiple statements. 3  4   public class Welcome2 5   { 6      // main method begins execution of Java application 7      public static void main( String[] args ) 8      { 9         System.out.print( "Welcome to " );        10         System.out.println( "Java Programming!" );11      } // end method main12   } // end class Welcome2

Welcome to Java Programming!

Fig. A.3 | Printing a line of text with multiple statements.

The program is similar ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.