我制作了这两个类以利用匿名内部类的概念。类 1 有一个静态内部类。2 级使用它。但我不明白如何调用内部类的方法。请帮帮我。
1级
public class outerclass {
outerclass() {
System.out.println("Constructor of new class");
}
public void showthis(String str) {
System.out.println(str);
}
static class insideclass {
insideclass() {
System.out.println("This is inside class constructor");
}
public void nowshowthis(String str) {
System.out.println(str);
}
}
}
2 级
public class helloworld {
public static void main(String args[]) {
//this is an object of the outer class
outerclass example=new outerclass();
//How do i make an anonymous inner class and call the method "nowshowthis()"
}
}