A1-Guy
2013-11-26 13:43:51 UTC
In which we first make a Node class
class Node
{
public int iData;
public String sData;
Node next; //Reference variable
////////////////Other methods///////////////
}//End of Node class
In "public class LinkedList class"
Confusion is when we create a Node by using following statement. Lets say:
Node playerList = new Node(10, David Beckham);
//I know this creates an object of Node Class and using "playerList" ref. variable i can call methods/functions of Node class
In LinkedList class we also have first field (datatype: Node) a reference variable(i.e not an object).
public class LinkedList()
{
Node first;
//Since it is a reference variable, not object does it mean it does not have access to Node class method or it does have access to Node class methods.
I hope i am making my question understandable
P.S: Wish there was a way to add snapshots with your question here?