Advertisement
Josif_tepe

Untitled

Nov 28th, 2021
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. public class Cas {
  2.     public static void main(String[] args) {
  3.        Father f = new Father();
  4.        f.print();
  5.  
  6.        f = new Son();
  7.        f.print();
  8.     }
  9. }
  10.  
  11. class Father {
  12.     void print() {
  13.         System.out.println("Father");
  14.     }
  15. }
  16. class Son extends Father {
  17.     void print() {
  18.         System.out.println("Son");
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement