提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
名为Hello的类中的内部类InnerHello:
public class Hello { class InnerHello { InnerHello () { /* N o w J a v a . c o m - 时 代 Java 提 供 */ System .out.println ( "The method call is coming from inside the class!" ); } } public Hello () { // empty constructor } public static void main (String [] arguments) { Hello program = new Hello (); /** from nowjava.com - 时代Java**/ Hello.InnerHello inner = program .new InnerHello (); } }