Advertisement
shawonrog

multiInheritance

Mar 19th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. package javalab;
  3.  
  4. class animal{
  5. void eat(){
  6. System.out.println("Eating.");
  7. }
  8. }
  9. class dog extends animal{
  10. void bark(){
  11. System.out.println("barking.");
  12. }
  13. }
  14. class cat extends dog{
  15. void leg(){
  16. System.out.println("four legs.");
  17. }
  18. }
  19.  
  20. public class Multipleinheritance extends cat{
  21.  
  22. public static void main(String[] args) {
  23. cat c1=new cat();
  24. c1.bark();
  25. c1.eat();
  26. c1.leg();
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement