This section of our 1000+ Java MCQs focuses on Observable & Timer class of Java Programming Language.
1. What is the use of Observable class?
a) It is used to create global subclasses
b) It is used to create classes that other part of the program can observe
c) It is used to create classes that can be accessed by other parts of program
d) It is used to create methods that can be accessed by other parts of program
Explanation: The Observable class is used to create subclasses that other part of program can observe.
2. Which of these methods is used to notify observer the change in observed object?
3. Which of these methods calls update() method?
Explanation: notifyObserver() notifies all the observers of the invoking object that it has changed by calling update(). A null is passed as the second argument to update().
4. Which of these methods is called when observed object has changed?
d) all of the mentioned
5. Which of these classes can schedule task for execution in future?
Explanation: Timer and TimerTask are the classes that support the ability to schedule tasks for execution at some future time.
6. Which of these interfaces is implemented by TimerTask class?
7. Which of these package provides the ability to read and write in Zip format?
Sanfoundry Global Education & Learning Series Java Programming Language.