int currentBalance()
Other names for the method would also work, of course.
class CheckingAccount
{
// instance variables
String accountNumber;
String accountHolder;
int balance;
//constructors
. . . .
// methods
int currentBalance()
{
return________________
}
}
The method returns the current balance, which is an int
so the return type is "int".
The method does not need any input data,
so its parameter list is empty.
You still need to have the two parentheses ( )
even though there
is nothing inside of them.
So far, the class looks like this:
All you need to put in currentBalance()
is a statement that returns the
balance of the checking account.