Interfaces Flashcards
To define (declare) an interface class we use the keyword?
Interface
interfaces imposed at ? (Compile or runtime)
compile time
if a class implements an interface, all methods must be ?
overridden
A class can implement … number of interfaces?
many
a class can extend how many classes ?
at most one
interfaces can be in form of ?
fields or methods
data members of interface are
public static final
all methods of interface are
public abstract
interface is implemented using the keyword
implements
does an interface need a constructor? why?
no, because it can’t be instantiated
can interfaces inherit each other? how?
yes, by using extends
java supports multiple inheritance in form of?
in form of interfaces
all methods in an interface must be overridden, unless?
they are declared abstract
if a superclass implements an interface, all subclasses?
also implement it
common interfaces in java?
- comparable (compareTo())
- comparator (compare(), equals())
- serializable
- cloneable