Why would you ever implement finalize()?

前端 未结 21 2641
耶瑟儿~
耶瑟儿~ 2020-11-22 16:50

I\'ve been reading through a lot of the rookie Java questions on finalize() and find it kind of bewildering that no one has really made it plain that finalize()

21条回答
  •  -上瘾入骨i
    2020-11-22 17:25

    I'm not sure what you can make of this, but...

    itsadok@laptop ~/jdk1.6.0_02/src/
    $ find . -name "*.java" | xargs grep "void finalize()" | wc -l
    41
    

    So I guess the Sun found some cases where (they think) it should be used.

提交回复
热议问题