компилятор пишет: non-static variable this cannot be referenced from a static context:
Solution.java, line: 10, column: 19
non-static variable this cannot be referenced from a static context:
Solution.java, line: 11, column: 19
package com.javarush.task.task06.task0603;
/*
По 50 000 объектов Cat и Dog
*/
public class Solution {
public static void main(String[] args) {
for (int i = 0; i < 50000; i++) {
Cat cat = new Cat();
Dog dog = new Dog();
}
}
class Cat {
@Override
protected void finalize() throws Throwable {
super.finalize();
System.out.println("Cat was destroyed");
}
}
class Dog {
@Override
protected void finalize() throws Throwable {
super.finalize();
System.out.println("Dog was destroyed");
}
}
}