Created
November 16, 2017 13:17
-
-
Save alexshavelev/207a64db5a7daa4750d07ae54b3b5990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.task.task13.task1314; | |
import java.awt.*; | |
/* | |
Большая лисица — это такая лисица | |
1. Исправь класс BigFox так, чтобы программа компилировалась. | |
Требования: | |
1. Интерфейс Animal должен быть реализован в классе Fox. | |
2. В классе Fox должен быть реализован только один метод(getName). | |
3. В интерфейсе Animal должен быть объявлен метод getColor. | |
4. Класс BigFox должен быть потомком класса 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 { | |
Color getColor(); | |
} | |
public static abstract class Fox implements Animal { | |
public String getName() { | |
return "Fox"; | |
} | |
} | |
public static class BigFox extends Fox { | |
// public Color() { | |
// return Color.GRAY; | |
// } | |
@Override | |
public Color getColor() { | |
return Color.GRAY; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment