Hi everyone I have a final exam for my Java class tomorrow and wondering if anyone could tell me if my answers are right? The questions are True/False. Thank you all!
- True/False — An interface may only contain method headers.
- True/False — An interface may not contain instance variables.
- True/False — Interfaces may be extended.
- True/False — When a class implements an interface, it must implement all of the methods in that interface.
- True/False — A class can implement only one interface.
- True/False — A class can extend another class, or implement an interface, but not both.
- True/False — The Comparable interface is often implemented by classes that require sorting.
- True/False — Interfaces are Java's way of simulating multiple inheritance (having more than one base class).
True/False — The compiler enforces interface semantics.
False, it can contain initialized public/static variables
- True, interfaces cannot be instantiated so makes sense to have no instance vars
- False if it means "class extend someInterface"? True is "someInterface extends otherInterface"?
- False? if it doesnt implement all methods it must be called abstract?
- True? My professor says yes but people online seem to have mixed opinions about this though.
- False? semantics is always up to the programmer?