Code Fix

上級 › is not abstract and does not override の原因と直し方 › パターン4

is not abstract and does not override の原因と直し方

抽象メソッドの実装漏れ。

 1  abstract class Shape {
 2      abstract double area();
 3      abstract double perimeter();
 4  }
 5  public class Main extends Shape {
 6      double area() { return 4.0; }
 7      __________________________________
                         ^
 8      public static void main(String[] args) {
 9          System.out.println(new Main().area());
10      }
11  }
Main.java:5: error: Main is not abstract and does not override abstract method perimeter() in Shape

空欄を埋めてビルドを通す

広告
広告スロット(未設定)

is not abstract and does not override の原因と直し方

extendsとimplementsの使い分け、可視性の制約も扱います。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)