Programming - Interfaces
You Are Here :: Home > JAVA > Interfaces - General Questions
1. |
an ________________ is a reference type, similar to a class, that can contain only constants, method signatures, and nested types.
|
A. |
Interface |
B.
|
Abstraction |
C.
|
Encapsulation
|
D.
|
Inheritance
|
|
Answer: Option A
Explanation:
an interface is a reference type, similar to a class, that can contain only constants, method signatures, and nested types. |
|
2. |
___________________ cannot be instantiated—they can only be implemented by classes or extended by other interfaces.
|
A. |
Interface |
B.
|
Abstraction |
C.
|
Encapsulation
|
D.
|
Inheritance
|
|
Answer: Option A
Explanation:
Interfaces cannot be instantiated—they can only be implemented by classes or extended by other interfaces. |
|
3. |
To use an ______________, you write a class that implements the interface.
|
A. |
Interface |
B.
|
Abstraction |
C.
|
Encapsulation
|
D.
|
Inheritance
|
|
Answer: Option A
Explanation:
To use an interface, you write a class that implements the interface. |
|
4. |
When an instantiable class implements an _________________, it provides a method body for each of the methods declared in the interface.
|
A. |
Interface |
B.
|
Abstraction |
C.
|
Encapsulation
|
D.
|
Inheritance
|
|
Answer: Option A
Explanation:
When an instantiable class implements an interface, it provides a method body for each of the methods declared in the interface. |
|
5. |
The _____________ access specifier indicates that the interface can be used by any class in any package.
|
A. |
Private |
B.
|
Protected |
C.
|
Public
|
D.
|
Default
|
|
Answer: Option C
Explanation:
The public access specifier indicates that the interface can be used by any class in any package. |
|
6. |
An _______________ can extend other interfaces
|
A. |
Interface |
B.
|
Abstraction |
C.
|
Encapsulation
|
D.
|
Inheritance
|
|
Answer: Option A
Explanation:
An interface can extend other interfaces |
|
next »