I have a sample code to solve which is based on inner
classes:
package inner;
class A {
void m() {
System.out.println("Outer");
}
}
public class TestInner {
public static void main(String[] args) {
new TestInner().go();
}
private void go() {
new A().m();
class A{
void m(){
System.out.println("Inner");
}
}
new A().m();
}
class A{
void m(){
System.out.println("Middle");
}
}
}
The output given by above sample code is:
Middle
Inner
And my question is, given that I dont want to use the package name to create an object, how can I print the output as:
Outer
Inner
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…