Cat and Dog objects: 50,000 each

  • 2
  • unavailable
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.
Comments(5)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin SmithLevel 8
5 November, 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, 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, 23:33
do(i < 50000)... not (i <=50000)
OreganoLevel 9
24 September, 06:03
Thank you for this comment. The task is a bit confusing...
VenkatLevel 6 , Bangalore
4 July, 10:02
What wrong I have done here?