class inside static method

public class Test {
public static void main(String args[]) {
class Foo {
public int i = 3;
}
Object o = (Object)new Foo();
Foo foo = (Foo)o;
System.out.println(“i = “ + foo.i);
}
}
So Foo is a static class, how come it can init an instance from static class?
thank you
public static void main(String args[]) {
class Foo {
public int i = 3;
}
Object o = (Object)new Foo();
Foo foo = (Foo)o;
System.out.println(“i = “ + foo.i);
}
}
So Foo is a static class, how come it can init an instance from static class?
thank you
Comments
As I understand it, instantiating static classes is legal and allowed in Java, but apparently there is no performance or access advantage in doing it.
Forum Admin at www.techexams.net
--
LinkedIn: www.linkedin.com/in/jamesdmurray
Twitter: www.twitter.com/jdmurray