I am using the method name in BigFox class as in Animal Interface...But it giving error at Main class "getColor" in System.out.println() method .Why?Anyone give such explanation?
package com.codegym.task.task13.task1314;
import java.awt.*;
/*
A big fox is still a fox
*/
public class Solution {
public static void main(String[] args) throws Exception {
Fox bigFox = new BigFox();
System.out.println(bigFox.getName());
System.out.println(bigFox.getColor());
}
public interface Animal {
public Color getColor();
}
public class Fox implements Animal{
public String getName() {
return "Fox";
}
}
public static class BigFox extends Fox implements Animal{
public Color getColor() {
return getColor().GRAY;
}
}
}