Question: Question 1 1 pts To respond to a button event, a listener must supply instructions for the _ _ _ _ method of the ActionListener
Question pts
To respond to a button event, a listener must supply instructions for the method of the ActionListener interface.
Group of answer choices
eventAction
actionPerformed
actionEvent
eventResponse
Flag question: Question
Question pts
Which of the following can potentially be changed when implementing an interface?
Group of answer choices
The return type of a method in the interface.
The types of parameters of a method in the interface.
The name of a method in the interface.
You cannot change the name, return type, or types of parameters of a method in the interface.
Flag question: Question
Question pts
Which of the following is true about a default method in an interface declaration?
Group of answer choices
A default method is a static method that does not have an implicit parameter.
A default method does not provide an implementation.
A class that implements the interface cannot override the default behavior.
A class that implements the interface can inherit the default behavior.
Flag question: Question
Question pts
Use the method to add a mouse listener to a component.
Group of answer choices
addActionListener
addMouseListener
addMouseActionListener
addListener
Flag question: Question
Question pts
Assume that the TimerListener class implements the ActionListener interface. If the actionPerformed method in TimerListener needs to be executed once per second, what statement should be used to complete the following code segment?
ActionListener listener new TimerListener;
missing statement
timer.start;
Group of answer choices
Timer timer new Timerlistener;
Timer timer new Timer listener;
Timer timer new Timer listener;
Timer timer new Timer listener;
Flag question: Question
Question pts
When you use a timer, you need to define a class that implements the interface.
Group of answer choices
TimerListener
TimerActionListener
ActionListener
StartTimerListener
Flag question: Question
Question pts
You wish to implement a callback method for an object created from a library class that you cannot change. What is the preferred way to accomplish this?
Group of answer choices
Extend the library class.
Use an inner class in the interface.
Create a new class that mimics the library class.
Use a helper class that implements the callback method.
Flag question: Question
Question pts
Using the given definition of the Measurable interface:
public interface Measurable
double getMeasure;
Consider the following code snippet, assuming that BankAccount has a getBalance method and implements the Measurable interface by providing an implementation for the getMeasure method:
Measurable m new Measurable;
System.out.printlnmgetMeasure;
Which of the following statements is true?
Group of answer choices
The code executes, displaying the measure of the Measurable object.
The code does not compile because interface types cannot be instantiated.
The code compiles but generates an exception at run time because getMeasure does not return a String.
The code compiles but generates an exception at run time because m does not reference a BankAccount object.
Flag question: Question
Question pts
Which of the following statements about interfaces is NOT true?
Group of answer choices
An interface can supply a default implementation.
Interfaces can make code more reusable.
An interface can describe the state that should be maintained.
An interface describes the behavior that an implementation should supply.
Flag question: Question
Question pts
Which of the following is an event source?
Group of answer choices
An inner class.
An event listener.
A JButton object.
An event adapter.
Flag question: Question
Question pts
Consider the following code snippet:
public interface Measurable
double getMeasure;
boolean largerThanMeasurable other
return getMeasure other.getMeasure;
Which of the following completes the interface declaration correctly?
Group of answer choices
public
private
final
default
Flag question: Question
Question pts
Assuming that interface Resizable is declared elsewhere, consider the following class declaration:
public class InnerClassExample
public static void mainString args
class SizeModifier implements Resizable
class methods
missing statement
Which of the following declarations can be used to complete the main method?
Group of answer choices
SizeModifier something new Resizable;
Resizable something new Resizable;
Resizable something new InnerClassExamp
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
