February 2014
Beginner
1248 pages
62h 25m
English
Next, we’d like to use class Account in an app and call each of its methods. A class that contains a main method begins the execution of a Java app. Class Account cannot execute by itself because it does not contain a main method—if you type java Account in the command window, you’ll get an error indicating “Main method not found in class Account.” To fix this problem, you must either declare a separate class that contains a main method or place a main method in class Account.
To help you prepare for the larger programs you’ll encounter later in this book and in industry, we use a separate class AccountTest (Fig. 3.2) containing method main
Read now
Unlock full access