Java: How to check if object is null?

前端 未结 9 1400
甜味超标
甜味超标 2021-01-30 08:11

I am creating an application which retrieves images from the web. In case the image cannot be retrieved another local image should be used.

While trying to execute the f

9条回答
  •  悲&欢浪女
    2021-01-30 08:46

    It's probably slightly more efficient to catch a NullPointerException. The above methods mean that the runtime is checking for null pointers twice.

提交回复
热议问题