Quote:
Originally Posted by deanosrs
See when I put the <int>'s there I get the error: "found: int, required: reference" and also "generic array creation", I really don't know whats going on with it...
|
What version of Java are you using? The <object> syntax only works with version 1.5. (
edit: Oh, and it seems like Java's autoboxing doesn't extend to generic typing, so it's <Integer> and not <int>, as _James_ points out)
Also, there isn't any code in which you instantiate your LinkedLists. Arrays of objects are created empty. You have to populate them first. For instance:
LinkedList[] graph = new LinkedList[100]; // empty array of type LinkedList
for (int i = 0; i < graph.length; i++) // populate array with LinkedLists
graph[i] = new LinkedList();
This is something that frequently confuses people. Personally, I don't think Java's the best language to teach people with, as it does have a few unintuitive parts to it for those unfamiliar with low level languages.