JAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comprised of in Java 7? 2) Can an interface have fields? 3) What is the access of all the methods in a Java interface? 4) Can an interface be instantiated? 5) Give two reasons for interfaces in the Java language. 6) How many interfaces can another class implement? 7) What does it mean to implement a Java interface? 8) If a class extends an Employee class and implements a Comparable interface, what are the is-a relationships established? 9) How many classes can a given class extend? 10) Name five Java pre-written interfaces. Solution Multiple Questions : Answering 6 Questions. 1) What is an interface comprised of in Java 7? An interface is a reference type in Java, it is similar to class, it is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. Along with abstract methods an interface may also contain constants, default methods, static methods, and nested types. Method bodies exist only for default methods and static methods. 4) Can an interface be instantiated? You cannot instantiate an interface. 6) How many interfaces can another class implement? A class can implement more than one interface at a time. 7) What does it mean to implement a Java interface? When a class implements an interface, you can think of the class as signing a contract, agreeing to perform the specific behaviors of the interface. If a class does not perform all the behaviors of the interface, the class must declare itself as abstract. A class uses the implements keyword to implement an interface. The implements keyword appears in the class declaration following the extends portion of the declaration. 9) How many classes can a given class extend? A Java class can only extend one parent class. Multiple inheritance is not allowed. 10) Name five Java pre-written interfaces. java.lang.Runnable java.util.concurrent.Callable java.io.FileFilter java.util.Comparator java.beans.PropertyChangeListener .