I am testing my college class and when the user types in "add" it adds a new student to the arraylist in the college class.
Scanner myInput=new Scanner (System.in);
String information=myInput.next(); //I know this is incorrect not sure what else to do
directory.addStudent(information);
here the directory is the object of the arraylist containing students. the addStudent method is in the College class, and looks like this:
public void addStudent (String studentName, long studentID, String address) {
Student newStu= new Student( studentname, studentID, address);
collegeList.add(newStu); //here collegeList is the name of the arraylist in College class
}
anyways my question seems simple but can't figure it out. I want to know how to split the information so that it can satisfy the parameters in addStudent method...As you can see information will be a String but I want studentID to be a long not a string what can I do?
X.parseX()methods where X are the common subtypes ofNumber.