Just a little smile ^ ^

yoyo_zeng

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年11月16日

摘要: 泛型类public class classname<type1, type2...>{}classnamen = new classname<String, Integer>();泛型接口public interface interfacename<type1, type2>{}泛型方法public <T> void functionname(T t){}泛型数组List<T> array = new ArrayList<T>();通配符List<object> list = new ArrayList< 阅读全文
posted @ 2012-11-16 15:41 yoyo_zeng 阅读(239) 评论(0) 推荐(1)

摘要: clone()方法负责建立正确的存储容量,并通过“按位复制”将 二进制位从原始对象中复制到新对象的存储空间Thread方法1:继承thread类,但是不能继承其他类,可扩展性低public class SimpleThread extends Thread { private int countDown = 5;private int threadNumber;private static int threadCount = 0; public SimpleThread() {threadNumber = ++threadCount;System.out.println("Makin 阅读全文
posted @ 2012-11-16 14:15 yoyo_zeng 阅读(310) 评论(0) 推荐(0)

摘要: Class对象Class.forName("classname");getSuperClass,getInterfaceinstanceof:判断对象是不是一个特定类型的实例。instanceof后面可跟class或者interface名称,它会返回一个布尔值(如果是相同类型或者是子类或者执行了接口,返回true):if(x instanceof Dog)((Dog)x).bark(); 阅读全文
posted @ 2012-11-16 10:54 yoyo_zeng 阅读(218) 评论(0) 推荐(0)

摘要: try {// Code that might generate exceptions} catch(Type1 id1) {// Handle exceptions of Type1 } catch(Type2 id2) {// Handle exceptions of Type2 } catch(Type3 id3) {// Handle exceptions of Type3}finally {// 每次都会发生的情况} throws;后面跟随全部潜在的违例类型。方法定义可能抛出的异常:void f() throws tooBig, tooSmall,... 阅读全文
posted @ 2012-11-16 09:56 yoyo_zeng 阅读(151) 评论(0) 推荐(0)