Raito :
Array ticket[x][2] is String, and ticket[x][1] is String too. The array ticket[x][1] is {"1", "2", "3"}. How to fill ticket[x][2]? I want in integer. In my code is still error using Integer.parseInt().
String[][] ticket = new String[8][3];
for (int x = 0; x < limit; x++) {
if(ticket[x][0].equals("festival")) {
ticket[x][2] = Integer.parseInt(ticket[x][1]) * 250000;
}
}
Elliott Frisch :
Because ticket[x][2]
is a String
(you are trying to assign an int
).
ticket[x][2] = "" + (Integer.parseInt(ticket[x][1]) * 250000);
or
ticket[x][2] = String.valueOf(Integer.parseInt(ticket[x][1]) * 250000);
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=334712&siteId=1