Jesus, any1 do java? Im used to using pointers. Im trying to do a linked list, but I cant get my head around it.
Here is my code to return the number of items in the list.
Code:
public int cardinality()
{
int count = 0;
word temp = this.FirstWord;
do
{
count++;
temp = temp.returnNext();
}while (temp!=null);
return count;
};
The line
Code:
temp = temp.returnNext();
Seems to be messing up the list, as it sets whats in temp, to equal whats in the next item. Where as I just want to point to that new item. Yes?
Im used to using C, where u can use pointers for everything. Does any1 know a way of doing it?
Morat, i think u program, help me.