程序如下:
import java.util.*;
class rr
{
LinkedList threadList = new LinkedList();
public int n=0;
public rr(int i,LinkedList thrList)
{
n=i;
threadList=thrList;
if(i!=0)
System.out.println(threadList.getFirst().n);
}
}
public class Fr {
public static void main(String s[]) {
LinkedList threadList=new LinkedList();
for(int i=0;i<2;i++)
{
rr obr=new rr(i,threadList);
threadList.add(obr);
}
}
}