このメソッドのリターン値を条件によって変えたいと思っているのですが、if, else文の中にリターン値を書いているにも関わらず、リターン値が無いという警告が出る理由が分かりません。
拙い文章ですがどなたかご教授頂ければ幸いです。
Java
1protected char lookAtTile(int y, int x) { 2 ClientThread thread = new ClientThread(); 3 int otherPlayerPos[]; 4 int threadid=1; 5 int theNumberOfThreadid = thread.getClientList().size(); 6 while(threadid<theNumberOfThreadid){ 7 otherPlayerPos=(int[]) thread.getClientList().get(threadid); 8 if (otherPlayerPos[0]==y && otherPlayerPos[1]==x){ 9 threadid++; 10 return 'P'; 11 } 12 else if (y < 0 || x < 0 || y >= map.length || x >= map[0].length){ 13 threadid++; 14 return '#'; 15 } 16 else{ 17 char output = map[y][x]; 18 threadid++; 19 return output; 20 } 21 } 22 }
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/03/09 17:20