Java Reference
In-Depth Information
Answers to Review Questions
1.
True, as with classes.
2.
False. Interfaces are not classes, but their bytecode appears in .class files. The name of
the .class file matches the name of the interface, and the directory structure must
match the package name, as with classes.
3.
True. Even if you do not use the abstract keyword, all methods in an interface are
abstract.
4.
False: Methods in an interface are public, even if you leave off the public keyword.
Attempting to declare a method in an interface as private or protected generates a
compiler error.
5.
Abstract. A class that does not implement all the methods of an interface must declare
itself as abstract.
6.
A tagging interface is an interface with no methods in it.
7.
There are many, but two that I emphasized in this chapter are exposing methods of a
class, and forcing behavior on a class.
8.
True. The interfaces are separated by commas after the implements keyword.
9.
True. The parent interfaces are separated by commas after the extends keyword.
10.
Final and static. Only final and static fields can be declared in any interface.
Search WWH ::




Custom Search