なぜ私の子クラスが正しく継承されないのか疑問に思いました。
もしわたしが持っていたら...
public class ArithmeticOp{
//some constructor
public static void printMessage(){
System.out.println("hello");
}
}
と別のクラス
public class AddOp extends ArithmeticOp{
//some constructor
ArithmeticOp op = new ArithmeticOp();
op.printMessage(); //returns error
}
私の日食は「トークン「printMessage」の構文エラー、このトークンの後に識別子が必要です」を返し続けます
誰か助けてもらえますか?ありがとう!親クラスからも子クラスからもメソッドを呼び出す他の方法はありますか?本当にありがとう!