The simple code below generates an error:
non-static variable this cannot be referenced from a static context
What does this error mean? Ok I understand that this is a wrong syntax for instantiating the inner class objects.But I am not clear how I am "referencing non static variable this from a static context" by doing so."
public class Test{
class Test1{}
public static void main(String[] args) {
// generates an error
new Test1();
}
}
does new Test1() in above code means this.new Test1();