i am new to all this...
right now i am stuck on generic linked lists
i have to create a recursive method to add newnode at end

i have this so far
public static <T> void insert(Node<T> l, Node <T> newNode)

if (l == null)
{l = newNode;
l.next =


the compiler is giving me an error " incompatible types found: void required: Node<T>.... for the line l.next = insert(L.next, newNode)

i am not sure of the syntax... can anyone help me with that

According to me the return type of insert should be Node<T> and not only <T>, cause thats what is the type of your "next" member of the Node class.

And next you you post code please make it a point to wrap it inside [code=java] and [/code] tags.

<T> is not the return type... it is passing the parameter type since it is generic linked list... return type is void

Eep mixed it up during copy paste, but still the return type should be Node<T> rather than "void", cause that is what should be the type of your "next" member of Node class.

thanks i think changing the return type helps. it is a textbook problem maybe there was a typo