Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. public class Mammal {
  2.     public void breathe() {
  3.         System.out.println("Inhale and exhale");
  4.     }
  5. }
  6.  
  7. public class Cat extends Mammal {
  8.     public void speak() {
  9.         System.out.println("Meow!");
  10.     }
  11. }
  12.  
  13. public class Exec {
  14.     public static void main(String[] args) {
  15.         Cat rani = new Cat();
  16.         rani.breath();
  17.         rani.speak();
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement