从main方法实例化内部类

时间:2015-02-27 03:21:10

标签: instantiation inner-classes

如何实例化内部类?例如:

    QuoteArray quotes1 = new QuoteArray(1);

    QuoteArray.Quote quote1 = new QuoteArray.Quote("quote","char","actor","film","year");//error here

Quote是QuoteArray的内部类。这一切对我来说都没有意义。我知道如何在QuoteArray中实例化Quote,但我不知道如何在我的main方法中执行此操作。

1 个答案:

答案 0 :(得分:0)

QuoteArray.Quote quote1 = new QuoteArray().new Quote("quote","char","actor","film","year");

这对我来说毫无意义,但它确实有效。

相关问题