62,614
社区成员
发帖
与我相关
我的任务
分享
public class Auto {
private float i;
public class Wheel {
public Wheel(float r) {
i = r;
}
}
}
public class Benz {
private float i;
class BenzWheel extends Auto.Wheel {
public BenzWheel(Auto a, float r) {
a.super(r);
i = r;
}
public String toString() {
return "i = " + i;
}
}
public static void main(String[] args) {
Benz b = new Benz();
Auto a = new Auto();
float r = 3.6f;
BenzWheel bw = b.new BenzWheel(a, r);
System.out.println(b.toString());
}
}