File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Mock Exam Errata and the fly likes Javacap mock test que-27 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Mock Exam Errata
Reply Bookmark "Javacap mock test que-27" Watch "Javacap mock test que-27" New topic
Author

Javacap mock test que-27

mads pawar
Greenhorn

Joined: Nov 10, 2000
Posts: 4
27. What is correct about event handling in Java?
A) Java 1.0 event handling is compatible with event delegation model in Java 1.1
B) Java 1.0 and Java 1.1 event handling models are not compatible
C) Event listeners are the objects that implements listener interfaces.
D) You can add multiple listeners to any event source, then there is no guarantee that the listeners will be notified in the order in which they were added.
ans given B,C,D,
I think c is not correct
listeners are itself interface. or it should be like
Adapter classes implements listener interface
//please explain whether i am right or wrong.
Kathy Rogers
Ranch Hand

Joined: Aug 04, 2000
Posts: 103
I think c is correct - quoting from RHE, "An event listener is an object to which a component has delegated the task of handling a particular event".
So when you do
class MyListener implements ActionListener{
public void actionPerformed(ActionEvent ae)
{
// some code here
}
}
and then in another class create an object of MyListener and use it as the ActionListener for a button:-
MyListener listen = new MyListener();
myButton.addActionListener(listen);
listen is the event listener. Cos listen is what myButton has delegated the task of handling action events to. Instances of Adapter classes could also be used as event listeners - although there wouldn't be much point as they wouldn't do anything. It is a bit confusing because of all the listener interfaces!
Kathy
mads pawar
Greenhorn

Joined: Nov 10, 2000
Posts: 4
thanx kathy
 
 
subject: Javacap mock test que-27
 
Threads others viewed
Question
listeners
event handling
Listners
JavaCaps mock 1 Q:27
developer file tools