During the discussion, one of my friends told me that concrete methods would be allowed in java 1.8 in interfaces , then at that time I came up with the question ie If they are allowed, how will we distinguish between the methods. For example, I have two interfaces Animal.java and Pet.java , and both have the same concrete method ie eat()
public interfaces Animal{ void eat(){ System.out.println("Animal Start eating ...."); } } public interfaces Pet{ void eat(){ System.out.println("Pet Start eating ...."); } }
Now my Zoo.java implements both of them and does not override
public class Zoo() implements Pet , Animal{
Now here is my confusion. How can I name a specific method for inteface animal using the Test object
public class Demo{ public static void main(String[] args){ Zoo zoo = new Zoo(); zoo.eat();
Any suggestions? or is there any solution for this in java1.8 since I cannot find his answer.
Freak
source share