标签:style blog http java color 2014


package heelo;
class MyThread  implements Runnable
{
	//private int a=6;  通不过编译
    //	private String a="daad"; 成功
	// private Integer a=new Integer(-33); 通过
	 //private int a[]=new int[10]; 通过
	//private Class a=Integer.class; 通过
	@Override
	public void run() {
		// TODO 自动生成的方法存根
		synchronized (a) {
			for(int i=0;i<5;i++)
			{
				System.out.println(Thread.currentThread().getName()+i);
			}
			
		}
		
	}
	
}
public class Solution
{
	public static void main(String args[])
	{
		MyThread my=new MyThread();
		
		Thread t1=new Thread(my,"AAAA");
		Thread t2=new Thread(my,"BBBB");
		t1.start();
		t2.start();
	}
}
搜狗一道java题目 关于对象 synchronized 关键字作用在 int, integer,布布扣,bubuko.com
搜狗一道java题目 关于对象 synchronized 关键字作用在 int, integer
标签:style blog http java color 2014
原文地址:http://www.cnblogs.com/hansongjiang/p/3825273.html