Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- public class Main {
- public static void main(String[] args) {
- Human hm = new Human();
- System.out.println("Now human:");
- hm.walk();
- hm.say();
- Child ch = new Child();
- System.out.println("\nNow child:");
- ch.walk();
- ch.say();
- }
- }
- class Human {
- public void say() {
- System.out.println("Hello!");
- }
- public void walk() {
- System.out.println("top top");
- }
- }
- class Child extends Human {
- public void say() {
- System.out.println("Blblbl");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement