3.2.3 Compiling and Executing an App with Multiple Classes

You must compile the classes in Figs. 3.1 and 3.2 before you can execute the app. This is the first time you’ve created an app with multiple classes. Class AccountTest has a main method; class Account does not. To compile this app, first change to the directory that contains the app’s source-code files. Next, type the command

javac Account.java AccountTest.java

to compile both classes at once. If the directory containing the app includes only this app’s files, you can compile both classes with the command

javac *.java

The asterisk (*) in *.java indicates that all files in the current directory ending with the filename extension “.java” should be compiled. ...

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.