首页 > 其他 > 详细

类与对象课后作业第一题

时间:2015-10-17 21:51:55      阅读:166      评论:0      收藏:0      [点我收藏+]
public class Test 
{
private int id;
private String name;
private static long count;
private final static ThreadLocal tl=new ThreadLocal();

public Test()
{
super();
count++;
tl.set(count);
}
public long getCount()
{
return (Long)tl.get();
}
public static void main(String[] args)
{
for (int i = 0; i < 5; i++)
{
Test t=new Test();
System.out.println(t.getCount());
}
}
}

类与对象课后作业第一题

原文:http://www.cnblogs.com/274761783cyf/p/4888204.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!