Interfaces
Questions
1 Here is the complete code for a proposed interface:
Interface Swoffable{Which of the following statements about the code is true?
int left = 1, right = 2;
void doSwoff(int direction);
}
a. The compiler will object to declarations of variables in an interface2 You can't define an interface by extending another interface.
b. Only classes implementing Swoffable will be able to refer to the left and right variables.
c. Programs will be able to treat Swoffable.left and Swoffable.right as constants.
d. None of the above.
a. TrueAnswers:
b. False
1. d) Variables declared in an interface must be constants!
2. b) You certainly can have one interface extend another.