• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Javacap mock test que-27

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx kathy
 
mooooooo ..... tiny ad ....
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic