Меня смутила эта часть:
Код: Выделить всё
// The following can't be compiled because
// generic type info does not exist at run time.
// if (iOb2 instanceof Gen2)
// System.out.println("iOb2 is instance of Gen2")
Код: Выделить всё
class Gen{}
class Gen2 extends Gen{}
public class Tester{
public static void main(String[] args){
Gen2 obj = new Gen2();
System.out.println(obj instanceof Gen2);
//output is true
}
}
Подробнее: https://stackoverflow.com/questions/799 ... ntime-java