阅读背景:

eclipse编译器或javac中的错误(“T的类型参数无法确定”)

来源:互联网 

The following code

以下代码

public class GenericsTest2 {

    public static void main(String[] args) throws Exception {
        Integer i = readObject(args[0]);
        System.out.println(i);
    }

    public static <T> T readObject(String file) throws Exception {
        return readObject(new ObjectInputStream(new FileInputStream(file)));
        // closing the stream in finally removed to get a small example
    }

    @SuppressWarnings("unchecked")
    public static <T> T readObject(ObjectInputStream stream) throws Exception {
        return (T)stream.readObject();
    }
}
public class Generi



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: