Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javalab;
- class animal{
- void eat(){
- System.out.println("Eating.");
- }
- }
- class dog extends animal{
- void bark(){
- System.out.println("barking.");
- }
- }
- class cat extends dog{
- void leg(){
- System.out.println("four legs.");
- }
- }
- public class Multipleinheritance extends cat{
- public static void main(String[] args) {
- cat c1=new cat();
- c1.bark();
- c1.eat();
- c1.leg();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement