Advertisement
jaVer404

level13.lesson02.task05_1

May 18th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. package com.javarush.test.level13.lesson02.task05;
  2.  
  3. /* 4 ошибки
  4. Исправь 4 ошибки в программе, чтобы она компилировалась.
  5. */
  6.  
  7. public class Solution
  8. {
  9.  
  10.     public static void main(String[] args) throws Exception
  11.     {
  12.  
  13.         System.out.println(new Dream().HOBBIE.toString());
  14.         System.out.println(new Hobbie().toString());
  15.  
  16.     }
  17.  
  18.         interface Desire
  19.         {
  20.         }
  21.  
  22.         static class Dream
  23.         {
  24.              static Hobbie HOBBIE = new Hobbie();
  25.         }
  26.  
  27.         static class Hobbie extends Dream implements Desire
  28.         {
  29.             static int INDEX = 1;
  30.  
  31.             @Override
  32.             public String toString()
  33.             {
  34.                 INDEX++;
  35.                 return "" + INDEX;
  36.             }
  37.         }
  38.  
  39. }
  40. /*
  41. Output:
  42. 2
  43. 3
  44. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement