Calling Nested Class Constructor from main()

Consider the following code:

publicclass OuterClass{

staticstaticvoid main(String[] args){

NestedClass nc =new NestedClass()

}

class NestedClass{

NestedClass(){

//constructor logic here

}

}

}

This call to the nested class constructor gives the following error: " 'OuterClass.this' cannot be referenced from a static context. However, if I cut and paste the code for NestedClass into its own class file, there are no error messages. I would like to be able to keep the class nested, so what do I need to do?

[1060 byte] By [mrk1410a] at [2007-10-3 3:27:40]
# 1
Declare the nested class to be static.
CeciNEstPasUnProgrammeura at 2007-7-14 21:21:08 > top of Java-index,Java Essentials,Java Programming...
# 2
>static static void main(String[] args) {>NestedClass nc = new NestedClass()>}public static void main(String[] args) { NestedClass nc = new NestedClass()}
java_2006a at 2007-7-14 21:21:08 > top of Java-index,Java Essentials,Java Programming...
# 3
[b]public [/b]static void main(String[] args) {NestedClass nc = new NestedClass()}
java_2006a at 2007-7-14 21:21:08 > top of Java-index,Java Essentials,Java Programming...