class example{
private int x=1;
public int xreturned(){
return x;
}
}
class example2<N>{
example2<N> variable;
public int fun(){
int x=variable.xreturned();
}
}
class mainclass{
public static void main(String[] args){
example2<example>obj=new example2<example>();
if(1.equals(obj.fun()))
System.out.println("correct");
return 0;
}
}
在 fun 函数变量中的 example2 类中找不到类示例的 xreturned() 函数,我怎样才能让它找到它?现在你可能会问我应该如何找到它?我想有可能找到它,因为 obj 具有示例(示例类的类型)通用 .. 所以请告诉我如何让它以最少的更改找到它