Hello I am trying to create a for loop that loops through the linked list. For each piece of data it will list it out individually. I am trying to learn linked list here, so no Array suggestions please. Anyone know how to do this?
Example Output:
- Flight 187
- Flight 501
CODE I HAVE SO FAR BELOW:
public static LinkedList<String> Flights = new LinkedList<String>();
public flightinfo(){
String[] flightNum = {"187", "501"};
for (String x : flightNum)
Flights.add(x);
for (???)
}