Ok heres the problem Im working on a final project for a java course and one thing is blocking my path.
import java.util.*;
public class Controller {
public List<CrewMember> list = new ArrayList<CrewMember>();
public void addItem() {
CrewMember cm = Academy.load(
MenuUtil.getAString("Enter the role: "),
MenuUtil.getAnInt("Enter the id number: "));
if(cm!=null) list.add(cm);
else System.out.println("Load Failed; nothing to add");
}
public void removeItem() {
int i = (
MenuUtil.getAnInt("Choose the crew member you wish to remove '0' being first in the list: "));
list.remove(i);
}
public void displayItems () {
for(CrewMember item : list ) {
System.out.println(item);
item.action();
}
}
public void display(String s) {
ListIterator it = list.Iterator();
System.out.println(s);
while(it.hasNext()) System.out.println(it.next());
}
public void run() {
Collections.sort(list);
display("After Sort:");
}
}
Controller.java:37: cannot find symbol
symbol : method Iterator()
location: interface java.util.List<CrewMember>
ListIterator it = list.Iterator();
^
Controller.java:43: cannot find symbol
symbol : method sort(java.util.List<CrewMember>)
location: class java.util.Collections
Collections.sort(list);
^
2 errors
Process completed.
In this one class Im getting these two errors. I think it may have something to do with how I started the array list but since I'm new to coding in java it could be anything that I've done. Does anyone know why I'm getting these errors and how i can fix it?