0

this is my code:

abstract class A{
public void sth1(){}
//code
}

public class B extends A{
public void sth2(){}
}

public class Test{
public static void main(String[] args){
A testObject=new B();
testObject.sth1(); // this line works 
testObject.sth2();  // at this line my code does not work
}

I'm trying to learn java by myself. I have trouble with this example. How can i fix that ?

0 Answers0