Podcast
Questions and Answers
Study Notes
Java Adapter Classes
- Adapter classes provide empty implementations of methods in an interface.
- Used to simplify the process of event handling.
- The java.awt.event package is required for adapter classes.
Question 1
- Correct answer: A
- java.awt.event package is needed for adapter classes
Question 2
- Correct answer: D
- Adapter class provides an empty implementation of event listener interface
Question 3
- Correct answer: D
- Adapter classes include WindowAdapter, KeyAdapter, MouseAdapter
Question 4
- Correct answer: D
- The output of the code is "componentShown"
Question 5
- Correct answer: B
- KeyAdapter class implements the KeyListener interface.
Question 6
- Correct answer:
f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { System.exit(0); } });
Question 7
- Correct answer: C
- FocusAdapter, FocusEvent
Question 8
- Correct answer: Inner
Question 9
- Correct answer: Listener
Question 10
- Correct answer: C
- ItemAdapter is not an adapter class.
Question 11
- Correct answer: B
- Adapter classes are used to simplify the process of event handling.
Question 12
- Correct answer: A
- An adapter class is an inner class
Question 13
- Correct answer: D
- WindowEvent is a subclass of Component Event.
Question 14
- Correct answer: C
- An adapter class provides an empty implementation of all methods in an interface.
Question 15
- Correct answer: B
- windowClosed() method does not belong to the WindowListener interface.
Question 16
- Correct answer: D
- windowIconified()
Question 17
- Correct answer: B
- ComponentAdapter
Question 18
- Correct answer: A
- Adapter classes use the methods of event classes.
Question 19
- Correct answer: A
- mouseDragged()
Question 20
- Correct answer: A
- Applet
Question 21
- Correct answer: C
- If an adapter class is inherited, there is no need to implement listener interfaces.
Question 22
- Correct answer: D
- Adapter classes can be used to incorporate inheritance, polymorphism, and encapsulation.
Question 23
- Correct answer: A
- In an adapter class, it is sufficient to only include the required methods.
Question 24
- Correct answer: B
- Adapter classes make programmers' tasks easier.
Question 25
- Correct answer: public
Question 26
- Correct answer: "componentShown"
Question 27
- Correct answer: Component Event
Question 28
- Correct answer: 1
Question 29
- Correct answer: B
- FocusAdapter
Question 30
- Correct answer: D
- Adapter classes and interfaces are not the same.
Question 31
- Correct answer: D
- Adapter classes save time, code, and space.
Question 32
- Correct answer: B
Question 33
- Correct answer: A
Question 34
- Correct answer: C
- A class that adapts methods of another class by giving different names to the same methods is called an adapter class.
Question 35
- Correct answer: A
Question 36
- Correct answer: D
Question 37
- Correct answer: B
Question 38
- Correct answer: C
Question 39
- Correct answer: A
Question 40
- Correct answer: A
Question 41
- Correct answer: D
Question 42
- Correct answer: D
Question 43
- Correct answer: B
Question 44
- Correct answer: D
Question 45
- Correct answer: C
- Code optimization
Question 46
- Correct answer: getEvent( )
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.