Hi, how can I complete this first point in list ? it's always incomplete :)

• #### Bolke

Yes, same here.

• #### Bolke

I don't understand the class definition. What does the line

Node next;

mean?

• #### Learneroo

Node is the name of the class (like Car or String). Each Node points to another Node called 'next' (though it could be called anything else as well).

• #### Ryan Vergara

In JavaScript we can implement a Node as follows (highly similar in form as the one in the lesson):

class Node {
constructor(data){
this.data = data;

• #### Notorious

A better implementation of the Node class.
class Node
{
private E element;
private Node next;
public Node(E element, Node next)

• #### Sarick Shah

``````public void add(int num){
tail.next = new Node(num);
tail = tail.next;

}

/*
* Returns value of node at given index
``````
• #### Sarick Shah

what am i supposed to return?

• #### Sarick Shah

this is telling me that my return value needs to be an integer, I'm lost

• #### Learneroo

@sarah, you can link to long pieces of code so you don't need to paste them here. The method `get` needs to return an integer (the value or data of a node). See if the new hint helps (or the new cheat option if you need it.)

• #### Sarick Shah

thanks, i realize what i was doing wrong.

• #### thales

Do i understand it correct if i say that head and tails arent nodes themselves?

• #### Learneroo

No, the first node in the list is the head and the last node is the tail. (If there's just one node, it's both the head and tail.)

• #### thales

When i state tail is head , can i consider them as one node with 2 names (startingpoint), or are they two different nodes with the same name. In case two i dont understand the line:

• #### thales

Node tail;

So i have two 'dummy' nodes. But what is the data en what is the pointer of head.

if head==0 -------------> what does this mean, what is null, the pointer? Then what is the data?

• #### thales

Nevermind, i understand it now. Its cause the default points to null.

Also i understand why i can say tail.next and it does the same for the head. This cause its a reference variable. So i guess i figured it out :-)

• #### catypus

Why is it supposed to be
and not

THis is driving me nuts! I drew this out on paper TWICE and while I understand the concept... I cant code it!

• #### Learneroo

Which part are you referring to? When there's only one item in the list, that item is both the head and the tail. This a correct solution.

• #### oorja

is that python 2.6
I am using python 3.5 working ok on my ide but here it is failing on

• #### Learneroo

Yes it's python 2.

• #### Joseph

Hello guys, I'm using the java.util.LinkedList implementation and it doesn't give the 'correct' output you are putting here, my implementation of LinkedList does the same output as java.util.LinkedList, are you sure the 'correct' output is correct at all? Thanks for this nice web page.

• #### Learneroo

Your code needs to handle the different input formats correctly. There are 2 new formats for this challenge: `-1 n` should remove a number at index `n`, and 2 positive numbers `a b` means insert `b` at index `a`.

• #### thales

Is there a featured awnser here. I would really like to be able to see the awnsers. I only get nullpointexceptions. How can i see the featered awnser if there is one, before i solve this. cause i dont think i can solve this.

• #### thales

my code

Really what am i doing wrong?? It says main.java54 nullpointer but rule 54 is the same as in the previous excersise. Can i just get the awnser please.

• #### Learneroo

54 means the error happened at line 54 in your code. Go there to fix it. nullpointer means you tried doing something with a null value.

• #### thales

Yes, i now rule/line 54 but here was nothing wrong there. it was the same as in the previous excersice strange but i had some help already thank you.

• #### senthil

10th step is supposed to remove the number 5 which will be in 2th position. Not sure how will it get printed after 14. I get the out pust as 3
11
14
7
7
10
3
2

• #### Cris

@senthil, you might want to read again the requirement/instruction for the `remove(index)` method, the answer to your question is in there.

• #### thales

I got the correct output and a correct check. But also an error message, i dont know if that is importent i just mention it.

Note: /usercode/Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

my code

• #### Learneroo

That looks like it has to do with the way you used a Java stack.

• #### Chibuzor Efedigbue

I think you are supposed to implement the LinkedList to solve your problem ansd not the built-in Stack module

• #### thales

It says correct but also gives a weird error. I dont know what it is?
I just mention it: Note: /usercode/Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

a solution my code