sharath123in
asked on
Exception in thread main
Here is my module to create a linked list and display it..How can I fix the error with it..and I want to add3 data element in one node ..How can I do that..
L.add("4","5.5");
..............
import java.util.*;
class Linkedlist
{
public static void main(String args[])
{
LinkedList L = new LinkedList();
L.add("23");
L.add("45");
L.add("12");
L.add("15");
L.add("10");
System.out.println(" Link list :"+ L);
}
}
L.add("4","5.5");
..............
import java.util.*;
class Linkedlist
{
public static void main(String args[])
{
LinkedList L = new LinkedList();
L.add("23");
L.add("45");
L.add("12");
L.add("15");
L.add("10");
System.out.println(" Link list :"+ L);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or as a List use:
L.add(Arrays.asList(new String[] { "4", "5.5" }));
L.add(Arrays.asList(new String[] { "4", "5.5" }));
code looks fine, how are you running it?
Should be
java Linkedlist
Should be
java Linkedlist
No Problem with code
javac Linkedlist.java
javac Linkedlist
should return the output
Link list :[23, 45, 12, 15, 10]
javac Linkedlist.java
javac Linkedlist
should return the output
Link list :[23, 45, 12, 15, 10]
ASKER
I am using text pad ..so I am using ctrl+2 to run it
is that the complete error you are getting? or does it include more information.
Make sure your classpath contains the directory that your class file is in.
Make sure your classpath contains the directory that your class file is in.
ASKER