What is inner class in java code example
public class Test {
public void MethodOne() {
System.out.println("Inside Test class");
}
public class InnerC {
public void MethodOne() {
System.out.println("Inside InnerC class");
}
public void test() {
this.MethodOne();
Test.this.MethodOne();
}
}
public static void main(String[] args) {
Test.InnerC i = new Test().new InnerC();
i.test();
}
}
public void MethodOne() {
System.out.println("Inside Test class");
}
public class InnerC {
public void MethodOne() {
System.out.println("Inside InnerC class");
}
public void test() {
this.MethodOne();
Test.this.MethodOne();
}
}
public static void main(String[] args) {
Test.InnerC i = new Test().new InnerC();
i.test();
}
}
Comments
Post a Comment