I was starting on linked list program in java but there was a problem struck on my mind that if pointers are not allowed in java then how are linked list created in java.(I am familiar with linked list in C++). I have got this class LinkedList
to create the node
public class LinkedList {
Node head; // head of list
// Linked list Node.
// This inner class is made static
// so that main() can access it
static class Node {
int data;
Node next;
// Constructor
Node(int d)
{
data = d;
next = null;
}
}
The code works but i am not getting as how the reference is being created at the next node.