内部类的实例化

时间:2012-04-25 01:08:10

标签: java class object inline instantiation

在下面的代码中,如何到达内部类'wheel'?

public class InstantiateClass {
public static void main(String[] args) {
    Car c = new Car();
    //not sure how to get an instance of 'Wheel' here 
}

}

class Car{
public static class Wheel{

}
}

1 个答案:

答案 0 :(得分:4)

Car.Wheel w = new Car.Wheel();

应该这样做。