почему не подходит в цикле знак i<=50000, ведь при < будет 49999, не?
public class Solution {
public static void main(String[] args) {
Cat cat;
Dog dog;
for(int i=0; i<50000;i++) {
cat = new Cat();
dog = new Dog();
}
}
}
class Cat {
@Override
protected void finalize() throws Throwable {
super.finalize();
System.out.println("A Cat was destroyed");
}
}
class Dog {
@Override
protected void finalize() throws Throwable {
super.finalize();
System.out.println("A Dog was destroyed");
}
}