Why inside Main.class to instantiate a Foo class(its inner class) I have to specify it with static keyword but if I make this class as outer it is possible without 'static'?
public class Main {
public static void main(String[] args) {
Foo foo = new Foo();
}
// class Foo { // to make it work I have to add 'static'
// }
}
But if Foo.class is not Inner class of Main.class it works.
public class Main {
public static void main(String[] args) {
Foo foo = new Foo();
}
}
class Foo {
}