fork download
  1. class Phone {
  2. static void call() {
  3. System.out.println("Call-Phone");
  4. }
  5. }
  6. class SmartPhone extends Phone{
  7. static void call() {
  8. System.out.println("Call-SmartPhone");
  9. }
  10. }
  11. public class Main {
  12. public static void main(String[] args) {
  13. Phone phone = new Phone();
  14. Phone smartPhone = new SmartPhone();
  15. phone.call();
  16. smartPhone.call();
  17. }
  18. }
Success #stdin #stdout 0.07s 54580KB
stdin
Standard input is empty
stdout
Call-Phone
Call-Phone