Cat and Dog objects: 50,000 each

  • 2
  • Locked
If you have not yet been touched by the beauty of loops in programming, try finishing this task without them. Of course, this task isn't so much about loops as it is about the destruction of unused objects. Anyway, create 50,000 each of Cat and Dog objects in a loop. Doing this will force the Java machine to call the finalize method at least a few times.
You can't complete this task, because you're not signed in.
  • Popular
  • New
  • Old
You must be signed in to leave a comment
YugLevel 10 , Dehra Dun
1 August, 17:12
for(int i =0; i<50000 ; i++)
Justin SmithLevel 8
5 November 2019, 02:40
In this task all you really need to do is create the loop for the object creation and nullification. They have done everything else for you. Admin, intellij is giving a lot of errors about finalize being deprecated, wasn't sure if you are aware.
Chanda B BarrickLevel 7 , Seattle
15 August 2019, 01:01
I didn't actually get any output showing the finalize method was called for 50,000, but incrementing to 500,000 did trigger the finalize method.
Laurence Chadwell Level 7 , San Antonio
22 September 2019, 23:33
do(i < 50000)... not (i <=50000)
OreganoLevel 24 , Warsaw
24 September 2019, 06:03
Thank you for this comment. The task is a bit confusing...
VenkatLevel 6 , Bangalore
4 July 2019, 10:02
What wrong I have done here?