摘要: 创建线程的两种传统方式 1).在Thread子类覆盖的run方法中编写运行代码[java] view plaincopyprint?Thread thread1=new Thread(){ @Override publicvoid run() { while(true){ try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("0 : "+Thread.currentThread ().getName()); } } };.. 阅读全文
posted @ 2012-12-22 22:08 tse johnson 阅读(186) 评论(0) 推荐(0) 编辑
摘要: ------- android培训、java培训、期待与您交流! ----------泛型是提供给javac编译器使用的,可以限定集合中的输入类型,让编译器挡住源程序的非法输入,编译器编译带类型说明的集合时会去除掉“类型”信息,使程序院校效率不受影响。对于参数化的泛型类型,getClass()方法的返回值和原始类型完全一样。由于编译生成的字节码会去掉泛型的类型信息,只用能跳过编译器,就可以往某个泛型集合中加入其他类型的数据,例如,用反射得到集合,再调用其add方法即可。 ArrayList<String> collection2=new ArrayList<String> 阅读全文
posted @ 2012-12-22 22:07 tse johnson 阅读(198) 评论(0) 推荐(0) 编辑