Question 1 True/False 1) A class may extend one or more classes. TRUE FALSE2) A class may implement one or more interfaces. TRUE FALSE. The following code fragment is associated with problems 3) and 4) public abstract class SomeClass{ public SomeClass(){ //implementation not shown }//remainder of implementation not shown } public interface SomeInterface{ //declarations not shown } 3)The statement SomeClass c = new SomeClass();will not compile in Java. TRUE FALSE 4)The statement SomeInterface i = new SomeInterface();will not compile in Java. TRUE FALSE 5) Events in Java are objects that are created by Event Sources (such as JButtons, JPanels, and other Components). TRUE FALSE 6)Each Event Listener (for example, a class that implements the ActionListener interface) can only register to receive Events from one Event Source (for example, one JButton). TRUEFALSE

7) Multiple different Event Listeners can register to receive Events from the same Event Source. TRUE FALSE8)You want to extend JPanel to make a new class that draws a smiley face in the middle of the JPanel. Where should you put your drawing code? Circle all that choices that apply: a) the repaint() method b) the constructorc) the paintComponent(Graphics g) method d) none of the above Question 2 - Inheritance and Interfaces QuizClass, QuizClass2and QuizInterface are all in the same package. However, QuizClassand QuizInterfaceare incomplete. Read and complete the code fragments below for QuizClassand QuizInterface. //QuizClass.java public abstract class QuizClass{ protected double var1; public static final int CONS1=10;private float var2; public QuizClass(double var1, float var2){ /*Part 1: complete the constructor,

This
preview
has intentionally blurred sections.
Sign up to view the full version.