Question :
Chapter 4-
True/False
Classes which share a role or capability but : 2043797
Chapter 4-
True/False
- Classes which share a role or capability but have little else in common can be grouped together using an interface.
- A class that implements at least one of the abstract methods specified in an interface is said to implement the interface.
- A class can implement only one interface.
- It is possible to build a hierarchy of interfaces in Java.
- The textbook recommends that instance variables be declared in the following order: attributes, then components and finally peer objects.
- Peer objects are initialized in the constructor by instantiating a new object for every peer, according to the class-definition recipe.
- The keyword this followed by parentheses (i.e. this();) will invoke the constructor with no parameters of the same class in which the statement appears.
- The default value recipe, says the parameterized constructor for the same class should be invoked with the default value as the parameter when writing the default constructor.
- A Java interface can contain both abstract and concrete methods.
Answer False. A Java interface contains only abstract methods.
- The correct Java syntax for saying that class Toy implements the interface Moveable is: public class Toy extends Moveable { . . .}
Solution
5 (1 Ratings )
Related Answers