Advertisement
jaVer404

level13.lesson11.home10

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