Are there any reasons to have an abstract class with every method in the class defined?

后端 未结 7 706
名媛妹妹
名媛妹妹 2021-02-05 01:42

It seems that an abstract class means the definition of the class is not complete and hence cannot be instantiated.

And I saw some simple Java code which has an abstract

7条回答
  •  甜味超标
    2021-02-05 02:19

    If a Java class is declared abstract yet has all of its methods declared, then they are doing it so it cannot be instantiated, though it may be subclassed.

    "Abstract classes cannot be instantiated, but they can be subclassed." See here: https://docs.oracle.com/javase/tutorial/java/IandI/abstract.html

提交回复
热议问题