5-2 类型转换 @SuppressWarnings("unchecked")

package object;

import java.util.ArrayList;

public class ArrayListO {
    /**
     * @author:lixh
     */
    public static void main(String[] args) {
        @SuppressWarnings("unchecked") 
        ArrayList<String> list = (ArrayList<String>)method1();
    }
    
    private static ArrayList method1(){
        return new ArrayList();
    }
}

 

posted @ 2018-01-04 00:27  aLa神灯  阅读(227)  评论(0编辑  收藏  举报