Explicit vs implicit call of toString

前端 未结 5 869
日久生厌
日久生厌 2020-12-01 04:31

I used to use the implicit call of toString when wanting some debug info about an object, because in case of the object is null it does not throw an Exception.

For i

5条回答
  •  Happy的楠姐
    2020-12-01 05:07

    Actually, if your invariant says the object should never be null, it doesn't matter. So it depends on whether or not you accept obj to be null.

提交回复
热议问题