Hi i have written this program in java but the following error appears at this line: System.out.println(List L + "=======\n"); (the error says that ')' is expected). Here is the complete program.
import java.util.*;
class myList1
{
public static void printList(List L)
{
for (int i=0;i
System.out.println(List L + "=======\n");
}
public static void main(String[] args)
{
List names = new LinkedList();
names.add("Jones, M ");
names.add("Smith, J ");
names.add("Bloggs, F ");
names.add("Thompson, A ");
names.add("McCullough, G");
names.add("Ling, Y ");
printList(names);
}
}
What could the problem be? I am trying to complete a method that for each item in L in turn (starting at position 0, counting in i, for a total of L.size() times): Get the string item at position i, and print it; At the end, print a final underline.
2007-02-19
07:08:07
·
5 answers
·
asked by
Princess Peach
3
in
Computers & Internet
➔ Programming & Design