package animalfilereader;
/**
* @author Greg
*/
public class Animal {
private int id;
private String name;
private String type;
private String age;
//getters and setters
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
// appending and reading
@Override
public String toString(){
return "\nID = "+getId()+" Name: "+getName()+" Type = "+getType()+" Age = "+getAge();
}
}
后面是类和.csv文件
distance = (
Store.coordinates.cast(Geometry)
.distance_centroid(query_centroid)
.cast(db.Float)
.label('distance')
)
stores = stores.order_by(distance).add_columns(distance)
animals.csv
1,Timone,Meerkat,5 years old 2,Pumba,Warthog,7 years old 3,Simba,Lion,3 years old 4,Rafiki,Monkey,50 years old
我一直收到此错误
Exception in thread "main" java.lang.NumberFormatException: For input string: "data" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at animalfilereader.AnimalFileReader.main(AnimalFileReader.java:51) Java Result: 1 BUILD SUCCESSFUL (total time: 1 second)
不确定发生了什么。有人能指出我正确的方向吗?