今天写了一个简单的将对象加入到数组中的程序。代码没有提示任何错误但是编译器来控制台提示了Exception in thread "main"  java.lang.NullPointerException,后来检查了代码才发现,自己定义的数组是20

编译提示:java.lang.NullPointerException Exception in thread "main"

但是我加入数组的对象只有3个。

编译提示:java.lang.NullPointerException Exception in thread "main"

所以控制台一直提示:

编译提示:java.lang.NullPointerException Exception in thread "main"

后来把数组长度改到合适的就可以啦,

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2021-10-14
  • 2021-09-11
  • 2021-10-10
猜你喜欢
  • 2021-11-29
  • 2021-11-08
  • 2021-07-03
  • 2021-12-14
  • 2022-12-23
  • 2021-06-05
  • 2021-05-03
相关资源
相似解决方案