Google says to call any non-static method or variable in a static context, you need to construct the object first. This is exactly what I did here but I am still getting an error:
public class Example
{
public static void main(String args[]){
One one = new Two("Lovelace");
one.methodA();
one.methodB();
}
public class One
{
public One(){
System.out.println("Turing");
}
public void methodA(){
System.out.println("zuse");
}
public void methodB(){
methodA();
}
}
public class Two extends One {
public Two(String s){
System.out.println(s);
}
public void methodA(){
System.out.println("Von Neumann");
}
}
I am getting an error on One one = new Two("Lovelace");
it says non static variable cannot be referenced from a static context but I literally created a new object so whats happening?