You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having issues with the code where we parseInt the String numbers[ ] where we read the map data. I am not sure where my issue lies but I cannot for the life of me figure it out. I'll post the code and if you think you could point in the right direction . It would be much appreciated.
public void loadMap(String filePath) {
try {
InputStream is = getClass().getClassLoader().getResourceAsStream(filePath);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
int col = 0;
int row = 0;
while(col < gp.maxWrldCol && row < gp.maxWrldRow){
String line = br.readLine();
while(col < gp.maxWrldCol) {
String numbers[] = line.split(" ");
int num = Integer.parseInt(numbers[col]); _***////* this is where i recieve a NumberFormatException.**_
mapTileNum[col][row] = num;
col++;
}
if(col == gp.maxWrldCol) {
col = 0;
row++;
}
}
br.close();
}catch(Exception e) {
e.printStackTrace();
}
}
The text was updated successfully, but these errors were encountered:
On the line where it parseInt the String numbers. It is throwing a numberFormatException. I know it's supposed to clear the space between the numbers and return a int from the string we use to read the map data. I'm just not 100 percent sure where my issue lies. Let me know if you would need to see my entire code.
I am having issues with the code where we parseInt the String numbers[ ] where we read the map data. I am not sure where my issue lies but I cannot for the life of me figure it out. I'll post the code and if you think you could point in the right direction . It would be much appreciated.
public void loadMap(String filePath) {
The text was updated successfully, but these errors were encountered: