Topic: Java 1.5 泛型问题

  Print this page

1.Java 1.5 泛型问题 Copy to clipboard
Posted by: Sunteya
Posted on: 2005-03-17 23:24


import java.util.*;
class A {
  public static void main(String[] args) {
    Object obj = new ArrayList<String>();
    ArrayList<String> aa = (ArrayList<String>) obj; //warning
  }
}


JAVA 1.5 编译这段代码运行时出现警告,说 未检查的交验。
那请教怎么交验才能使从 Object 转换到 ArrayList<String> 的这个警告消除呢,谢谢?


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923