Java Gold
interface SampleInterface {
void method();
}
public class Outer {
public static class InnerStatic {
static int i1;
static void method() {
System.out.println("i am Inner class method of static");
}
}
public class InnerInstance {
int i1;
void method() {
System.out.println("i am Inner class method of instance");
}
}
public static void main(String[] args) {
class LocalClass {
int i2;
void method() {
System.out.println("i am local class method");
}
}
Outer.InnerStatic.method();
Outer o = new Outer();
InnerInstance ii = o.new InnerInstance();
ii.method();
LocalClass l1 = new LocalClass();
l1.method();
SampleInterface si = new SampleInterface() {
@Override
public void method() {
System.out.println("i am anonymous class method");
}
};
si.method();
}
}
i am Inner class method of static
i am Inner class method of instance
i am local class method
i am anonymous class method