当前位置: 动力学知识库 > 问答 > 编程问答 >

java - How to differenciate instanciated variables from others?

问题描述:

This question already has an answer here:

  • What is a NullPointerException, and how do I fix it?

    12 answers

网友答案:

I think you want if grille[i][j] == null instead of dereferencing joueur on it.

网友答案:

The problem with your code is that you have empty spots in your array. The loops are going to make blind calls, grille[0][0].joule then grille[0][1].joule then grille[0][2]. Since you didn't assign grille[0][2] it's null. Thus your null pointer exception.

分享给朋友:
您可能感兴趣的文章:
随机阅读: