nerdexam
Oracle

1Z0-804 · Question #5

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()…

The correct answer is B. Type x must be an abstract class. D. Type x could implement or extend from Type y. F. Type y could be an abstract class or an interface. 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…

RAC Architecture

Question

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?

Options

  • AType y must be an interface.
  • BType x must be an abstract class.
  • CType y must be an abstract class.
  • DType x could implement or extend from Type y.
  • EType x could be an abstract class or an interface.
  • FType y could be an abstract class or an interface.

How the community answered

(25 responses)
  • A
    8% (2)
  • B
    84% (21)
  • C
    4% (1)
  • E
    4% (1)

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 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

Topics

#abstract classes#interfaces#Java type system#abstraction rules

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice