/Users/lyon/j4p/src/thread/LinkedList.java

1    package thread; 
2     
3    import java.util.Vector; 
4     
5    public class LinkedList { 
6        static class Node { 
7            Node next = null; 
8            Node previous = null; 
9            int nodeNumber = 0; 
10    
11           Node(int _nodeNumber) { 
12               nodeNumber = _nodeNumber; 
13           } 
14    
15           public String toString() { 
16               return //super.toString()+ 
17                       "Node#=" + 
18                       nodeNumber; 
19           } 
20       } 
21    
22       Vector v = new Vector(); 
23    
24       public void addNode(int i) { 
25           v.addElement(new Node(i)); 
26       } 
27    
28       public void print() { 
29           for (int i = 0; i < v.size(); i++) 
30               System.out.println( 
31                       (Node) v.elementAt(i)); 
32       } 
33    
34       public static Runnable getRunnable() { 
35           class Runs implements Runnable { 
36               public void run() { 
37                   System.out.println( 
38                           "Hello from inner local class!"); 
39               } 
40           } 
41           return new Runs(); 
42       } 
43    
44       public static Runnable getAnonymousRunnable() { 
45           return new Runnable() { 
46               public void run() { 
47                   System.out.println( 
48                           "Hello from getAnonymousRunnable!"); 
49               } 
50           }; 
51       } 
52    
53       //static LinkedList ll = new LinkedList(); 
54       // Node n = new Node(0); 
55       public static void main(String args[]) { 
56           System.out.println("Hello World!!!"); 
57           Runnable r = 
58                   LinkedList.getAnonymousRunnable(); 
59           r.run(); 
60           //LinkedList ll = new LinkedList(); 
61           //ll.addNode(0); 
62           //ll.addNode(1); 
63           //ll.print(); 
64       } 
65   } 
66    
67    
68    
69