Advertisement
jaVer404

level13.lesson04.task04

May 20th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. package com.javarush.test.level13.lesson04.task04;
  2.  
  3. import java.awt.*;
  4.  
  5. /* Класс BigFox
  6. 1. Исправь класс BigFox так, чтобы программа компилировалась.
  7. 2. Метод main менять нельзя.
  8. */
  9.  
  10. public class Solution
  11. {
  12.  
  13.     public static void main(String[] args) throws Exception
  14.     {
  15.  
  16.         Fox bigFox = new BigFox();
  17.         System.out.println(bigFox.getName());
  18.         System.out.println(bigFox.getColor());
  19.  
  20.     }
  21.  
  22.     public interface Animal
  23.     {
  24.         Color getColor();
  25.     }
  26.  
  27.     public static abstract class Fox implements Animal
  28.     {
  29.         public String getName() {
  30.             return "Fox";
  31.         }
  32.     }
  33.  
  34.     //add your code below
  35.     public static class BigFox extends Fox
  36.     {
  37.         public Color getColor () {
  38.             return Color.GRAY;
  39.         }
  40.     }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement