public class Solution { public static void main(String[] args) { // 在此编写你的代码 int num = 50000; for (int a = 0; a < num; a++) { Cat cat = new Cat(); Dog dog = new Dog(); } } } class Cat { @Override protected void finalize() throws Throwable { super.finalize(); System.out.println("一个 Cat 被销毁"); } } class Dog { @Override protected void finalize() throws Throwable { super.finalize(); System.out.println("一个 Dog 被销毁"); } }