Java Reference
In-Depth Information
harrysChecking.deposit(transferAmount);
88
89
S YNTAX 3.2 Constructor Definition
accessSpecifier ClassName(parameterType
parameterName, . . . )
{
constructor body
}
Example:
public BankAccount(double initialBalance)
{
. . .
}
Purpose:
To define the behavior of a constructor
S YNTAX 3.3 Class Definition
accessSpecifier class ClassName
{
constructors
methods
fields
}
Example:
public class BankAccount
{
public BankAccount(double initialBalance) {. .
.}
public void deposit(double amount) {. . .}
. . .
}
Purpose:
To define a class, its public interface, and its implementation details
Search WWH ::




Custom Search