I've searched for this problem but still not getting any solution.
I declared this simple program:
public class Test{
public abstract class Person {
public void talk(){
System.out.print("I am a person");
}
public abstract void display();
}
public class Student extends Person {
public void talk(){
System.out.println("I am a student");
}
public void display(){
System.out.println("Nice to meet you");
super.talk();
}
}
public static void main(String args[])
{
Student s = new Student();
s.display();
}
}
but it keeps giving me the error :
error: non-static variable this cannot be referenced from a static context
Student s = new Student();
I've always been declaring objects that way! I don't know what's happening today.
I need to understand what am I doing wrong here?