Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BankAccount
- {
- public static void main (String[] args) {
- BankAccount diddle = new BankAccount();
- diddle.deposit(1000);
- diddle.withdraw(500);
- diddle.withdraw(400);
- System.out.println(balance);
- System.out.println("expected: 100");
- }
- private static double balance;{
- }
- public void deposit(double amount) {
- balance = balance + amount;
- }
- public void withdraw(double amount) {
- balance = balance - amount;
- }
- public static double getBalance() {
- return balance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment