IllegalArgumentException or NullPointerException for a null parameter?

I have a simple setter method for a property and `null` is not appropriate for this particular property. I have always been torn in this situation: should I throw an [`IllegalArgumentException`][1], or a [`NullPointerException`][2]? From the javadocs, both seem appropriate. Is there some kind of an understood standard? Or is this just one of those things that you should do whatever you prefer and both are really correct? [1]: [2]:

以上就是IllegalArgumentException or NullPointerException for a null parameter?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准