A sample bank account class with a default constructor
Note that the vast majority of projects will separate out the main class from classes that produce objects (such as bank accounts).
public class BankAccount { private double balance; public BankAccount() { // default constructor this(1000); // calls one input constructor w/initial balance } public BankAccount(double amount) { balance = amount; } public void deposit(double amount) { balance += amount; } public double withdraw(double amount) { if (amount > balance) { System.out.println("FUGGEDDABOUDDIT"); return 0; } else { balance -= amount; return amount; } } public void showBalance() { // does not return money, just prints balance System.out.println(balance); } }