package does not exist?

Hey ppl

Trying to use a List Iterator with a linked list.

LinkedList knowledgeBase = new LinkedList();

ListIterator iter = new knowledgeBase.ListIterator();

and when i try to compile

IEPL.java:147: package knowledgeBase does not exist

ListIterator iter = new knowledgeBase.ListIterator();

^

I know the linked list works cause i can list all the links, but its only when i try add an iterator it stuffs up

Anyone know what am i doing wrong?

[501 byte] By [nardza] at [2007-10-2 1:36:54]
# 1

Your syntax is pretty far off. You want something like:

LinkedList knowledgeBase = new LinkedList();

ListIterator iter = knowledgeBase.listIterator();

I'd encourage you to take a look at [url=http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedList.html]the Javadoc for LinkedList[/url] and [url=http://java.sun.com/j2se/1.4.2/docs/api/java/util/ListIterator.html]for ListIterator[/url] for details on how to use these.

stdunbara at 2007-7-15 19:00:21 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

Thanks - Silly mistake including "new" in the ListIterator line.. i shouldve seen that.

Now it compiles with a different error.....

IEPL.java:147: cannot find symbol

symbol : method ListIterator()

location: class java.util.LinkedList

ListIterator iter = knowledgeBase.ListIterator();

I'm pretty sure ive used this method before...

Your help is greatly appreciated.

nardza at 2007-7-15 19:00:21 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3
Careful - Java is a case sensitive language. You want:ListIterator iter = knowledgeBase.listIterator();with a small L.
stdunbara at 2007-7-15 19:00:21 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 4
Thank you very much.It's always the simplest things that have me baffled!
nardza at 2007-7-15 19:00:21 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...