フリー問題

Java SE 11 Developer のフリー問題 8 / 20 問目

問題文

A subinterface extends one interface that declares a method as abstract and another that supplies a default method of the very same signature, and the build stops on the subinterface while a class that extends a superclass with a concrete method of that signature builds. What separates the two, and why?

選択肢

  1. The subinterface is an error while the class is not, because the language declines to give either inherited interface method priority over the other one and gives a concrete method of a class priority over an abstract interface method in the hierarchy of the subtype
  2. Both of them are errors, because the language declines to give either inherited method priority and asks the author of the subtype to declare a new method that overrides the ones which clash with one another in the two hierarchies
  3. Both of them are errors, because the language declines to give either inherited method priority and waits for a concrete class to be compiled before it reports the conflict between the abstract side and the side that carries a body
  4. The subinterface is an error while the class is not, because the language declines to give either inherited interface method priority over the other one and treats a concrete method of a class as a body that the interface side is barred from seeing at any time

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。