Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. The class AbstractButton is abstract. It is a sublcass of the JComponent clas

ID: 3801864 • Letter: 1

Question

1. The class AbstractButton is abstract. It is a sublcass of the JComponent class. It also implements two interfaces: ItemSelectable and SwingConstants. Fill in the blanks to complete the declaration of the class (case sensitive, check your spelling):

public _________________ class AbstractButton _____________ JComponent ______________ItemSelectable, SwingConstants

2. The ItemSelectable interface has method declaration for addItemListener, which returns void and has a parameter of type ItemListener. Which of the following code is correct for this declaration?

A.   public addItemListener(ItemListener l);

B.     public abstract void addItemListener(ItemListener l);

C.    public void addItemListener(ItemListener l) { }

A.   public addItemListener(ItemListener l);

B.     public abstract void addItemListener(ItemListener l);

C.    public void addItemListener(ItemListener l) { }

  D.  public abstract void addItemListener(String l);  

Explanation / Answer

Question 1:

Answer:

public _______abstract__________ class AbstractButton _____extends________ JComponent ______implements________ItemSelectable, SwingConstants

Question 2

Answer:

B.     public abstract void addItemListener(ItemListener l);