|
Computer Science (CSCI)
Department |
|||
|
|||
(Example code and figures from Computing Concepts with Java Essentials, 3rd edition, by Cay Horstmann)
Objects and Object Variables
int numberOfTrys = 0; double moneyEarned = 38.95; boolean moreToCome = true; |
double balance1 = 1000; |

balance2 = balance2 + 500; |
BankAccount account1 = new BankAccount(1000); |
account2.deposit(500); |
BankAccount newAccount;
...
if (newAccount == null)
System.out.println("Oops!");
|
from the AP CS Java Subset
Explicit and Implicit Parameters
public void withdraw(double amount) |
momsSavings.withdraw(500) |
public void withdraw(double amount) |
|
Exercise - playing with objects
|