Inheritance

 public class inheritance {

    public static void main(String[] args) {

        Fish f=new Fish();
        f.eats();
       
    }
   
}

class Animals{

    void eats(){

        System.out.println("Animal is eating");
    }
}

class Fish extends Animals{

    int fins;


}

Comments

Popular posts from this blog

Convert first letter to capital letter in java

Stair case traversal search

Palindrome of string my logic