public class Main {
public static void main(String[] args) {
RichJack jack = new RichJack();
jack.showYourWallet();
}
}
class Jack {
Jack() {
this.sayHello();
}
public void sayHello() {
System.out.println("I'm Jack!");
}
}
class RichJack extends Jack {
private int money = 0;
public RichJack() {
money += 100;
};
public void sayHello() {
money += 1000000000; // one billion
System.out.println("I'm rich Jack!");
}
public void showYourWallet() {
System.out.println("I have quite some money, about $" + money);
};
}
Login in to like
Login in to comment