Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level13.lesson02.task05;
- /* 4 ошибки
- Исправь 4 ошибки в программе, чтобы она компилировалась.
- */
- public class Solution
- {
- public static void main(String[] args) throws Exception
- {
- System.out.println(new Dream().HOBBIE.toString());
- System.out.println(new Hobbie().toString());
- }
- interface Desire
- {
- }
- static class Dream
- {
- static Hobbie HOBBIE = new Hobbie();
- }
- static class Hobbie extends Dream implements Desire
- {
- static int INDEX = 1;
- @Override
- public String toString()
- {
- INDEX++;
- return "" + INDEX;
- }
- }
- }
- /*
- Output:
- 2
- 3
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement