+ 1
Need help. on this java code. I did the code but i am getting errors. Also coded. this in itellij
I put the code in sololearn but it was originally in IntelliJ and in separate classes. here are the instructions for more context: lastName id For a Person object: firstName lastName We recommend using the String method .split() which returns an array of strings, to parse the line. Your method should loop through every line in the file, and add a new Person or Student object to the people ArrayList by calling the appropriate constructor with the appropriate arguments.
5 Respostas
+ 4
You use
initializeListFromFile(filename)
In SL Playground you cannot this do in this way. First you have to write the files here.
+ 1
https://code.sololearn.com/c48ZPL2IQyaD
here is the code I have now in Sololearn coding playground.
But It is in separate classes and tried to label. it to show.
ORIGINALLY in IntelliJ.
THANKS for the HELP.
+ 1
I think these are the problems that are in your code.
students.add(new Student(list[0], list[1], Integer.parseInt(list[2])));
public String toString(){
return "Student: " + this.firstName + " " + this.lastName + " " + this.id;
}
0
Ok, how do I fix these? Especially since it looks different on IntelliJ.
0
parseInt() write it lowerCase p
-
public String toString(){
return "Student: " +firstName +" "+
lastName +" "+
id;
}