Which three are true?

Given these facts about Java types in an application:
– Type x is a template for other types in the application.
– Type x implements dostuff ().
– Type x declares, but does NOT implement doit().
– Type y declares doOther() .
Which three are true?

Given these facts about Java types in an application:
– Type x is a template for other types in the application.
– Type x implements dostuff ().
– Type x declares, but does NOT implement doit().
– Type y declares doOther() .
Which three are true?

A.
Type y must be an interface.

B.
Type x must be an abstract class.

C.
Type y must be an abstract class.

D.
Type x could implement or extend from Type y.

E.
Type x could be an abstract class or an interface.

F.
Type y could be an abstract class or an interface.

Explanation:

Unlike interfaces, abstract classes can contain fields that are not static and final, and they can
containimplemented methods. Such abstract classes are similar to interfaces, except that they
provide a partialimplementation, leaving it to subclasses to complete the implementation. If an
abstract class contains onlyabstract method declarations, it should be declared as an interface
instead.
Note:
An interface in the Java programming language is an abstract type that is used to specify an
interface (in thegeneric sense of the term) that classes must implement. Interfaces are
declaredusing the interface keyword,and may only contain method signature and constant
declarations (variable declarations that are declared tobe both static and final). An interface
maynever contain method definitions.

Note 2: an abstract class is a class that is declared abstract–it may or may not include abstract
methods.Abstract classes cannot be instantiated, but they can be subclassed. An abstract method
is a method that isdeclared without an implementation (without braces, and followed by a
semicolon)



Leave a Reply 1

Your email address will not be published. Required fields are marked *