Executing the Welcome1 Application

The following instructions assume that the book’s examples are located in C:\examples on Windows or in your user account’s Documents/examples folder on Linux/OS X. To execute this program in a command window, change to the directory containing Welcome1.javaC:\examples\ch02\fig02_01 on Microsoft Windows or ~/Documents/ examples/ch02/fig02_01 on Linux/OS X. Next, type

java Welcome1

and press Enter. This command launches the JVM, which loads the Welcome1.class file. The command omits the .class file-name extension; otherwise, the JVM will not execute the program. The JVM calls class Welcome1’s main method. Next, the statement at line 9 of main displays "Welcome to Java Programming!". Figure 2.2 shows the program ...

Get Java™ How To Program (Early Objects), Tenth 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.