Cat counter

  • 2
  • Locked
There is balance in the universe. Stuff arrives somewhere and departs from somewhere else. It's not entirely clear what is flowing through our galaxy or where it is going. But it doesn't work this way with a computer and its discrete memory. Accordingly, you need to edit a couple of important things in this program. In the Cat class constructor, we will increment a counter by 1. Then in the finalize method, we'll decrement it.
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
Devjyoti Das
Level 14 , Jind, India
11 March 2021, 15:07
if i am right finalize has been deprecated since java 9
Level 17 , Bangalore, India
5 October 2018, 17:55
sorry guys I just forgot that constructor should not have any return type, nor even void
Muhammad Vahhaaj
Level 19 , Rawalpindi, Pakistan
11 June 2019, 16:28
Level 17 , Bangalore, India
5 October 2018, 17:52
Hi guys, In the constructor I have written like this....... public void Cat(){ Cat.catCount+=1; } what's the problem...with this?
Michael Shaw
Level 8 , United States
4 September 2019, 09:00
Remove the void