Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. package test;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Human hm = new Human();
  6.         System.out.println("Now human:");
  7.         hm.walk();
  8.         hm.say();
  9.         Child ch = new Child();
  10.         System.out.println("\nNow child:");
  11.         ch.walk();
  12.         ch.say();
  13.     }
  14. }
  15.  
  16. class Human {
  17.     public void say() {
  18.         System.out.println("Hello!");
  19.     }
  20.  
  21.     public void walk() {
  22.         System.out.println("top top");
  23.     }
  24. }
  25.  
  26. class Child extends Human {
  27.     public void say() {
  28.         System.out.println("Blblbl");
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement