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.
Cat counter
- 2
Locked
Comments (5)
- Popular
- New
- Old
You must be signed in to leave a comment
Devjyoti Das
11 March 2021, 15:07
if i am right finalize has been deprecated since java 9
0
sivakumar
5 October 2018, 17:55
sorry guys I just forgot that constructor should not have any return type, nor even void
+2
Muhammad Vahhaaj
11 June 2019, 16:28
yes
+1
sivakumar
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?
0
Michael Shaw
4 September 2019, 09:00
Remove the void
+2