fork(1) download
  1. class LinkedList{
  2. Node head;
  3. static class Node{
  4. int value;
  5. Node next;
  6.  
  7. Node(int e){
  8. value=e;
  9. next=null;
  10. }
  11. }
  12.  
  13. public static void main(String[] args){
  14.  
  15. l.head=new Node(1);
  16. Node second=new Node(2);
  17. Node third=new Node(3);
  18.  
  19. l.head.next=second;
  20. second.next=third;
  21.  
  22. while(l.head.next!=null){
  23. System.out.print(l.head.next);
  24. l.head=l.head.next;
  25. }
  26. }
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
Success #stdin #stdout 0.06s 32352KB
stdin
Standard input is empty
stdout
LinkedList$Node@5caf905dLinkedList$Node@27716f4