fork download
  1. package com.javarush.test.level13.lesson11.home06;
  2.  
  3. /* Исправление ошибок
  4. 1. Переделай наследование в классах и интерфейсах так, чтобы программа компилировалась и продолжала делать то же самое.
  5. 2. Класс Hobbie должен наследоваться от интерфейсов Desire, Dream.
  6. */
  7.  
  8. public class Solution
  9. {
  10.  
  11. public static void main(String[] args) throws Exception
  12. {
  13. System.out.println(Dream.HOBBIE.toString());
  14. System.out.println(new Hobbie().INDEX);
  15. }
  16.  
  17. interface Desire
  18. {
  19. }
  20.  
  21. interface Dream
  22. {
  23. static Hobbie HOBBIE = new Hobbie();
  24. }
  25.  
  26. static class Hobbie implements Dream, Desire
  27. {
  28. static int INDEX = 1;
  29.  
  30. @Override
  31. public String toString()
  32. {
  33. INDEX++;
  34. return "" + INDEX;
  35. }
  36. }
  37.  
  38. }
  39.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: error: class Solution is public, should be declared in a file named Solution.java
public class Solution
       ^
1 error
stdout
Standard output is empty