如果要使用类变量的话:
class a{
public static int int1=1;
}
在其它类中只需要:
class b{
int b =a.int1;//就这样调用
}
如果是成员变量的话:
class a{
public int int1=1;
}
在其它类中只需要:
class b{
a A=new a();
int b =A.int1;//就这样调用
}
class a{
public static int int1=1;
}
在其它类中只需要:
class b{
int b =a.int1;//就这样调用
}
如果是成员变量的话:
class a{
public int int1=1;
}
在其它类中只需要:
class b{
a A=new a();
int b =A.int1;//就这样调用
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货