What is adapter class?
Answers were Sorted based on User's Feedback
Java Language rule are such that we must implement all the
methods of an interface even if we put them into empty
braces.i.e. we must override all the methods declared in
the interface.
But we can create our classes as subclasses of one of
the adapter classes, then we need to override only some of
the methods we need. i.e, An adapter classes provide empty
implementation of all methods declared in an EventListener
interface.
| Is This Answer Correct ? | 191 Yes | 27 No |
Adapter class provides an empty implementation of all the
methods in EventListener interface.
| Is This Answer Correct ? | 184 Yes | 41 No |
Answer / khan
In java programming language, adapter class is used to
implement an interface having a set of dummy methods. The
developer can then further subclass the adapter class so
that he can override to the methods he requires.
Implementing an interface directly, requires to write all
the dummy methods. In general an adapter class is used to
rapidly construct your own Listener class to field events.
| Is This Answer Correct ? | 56 Yes | 8 No |
Answer / pratik vegad
in a java programming language if you have a not all method
use but only selected method used at that time you can use
adapter class.you can use either one or all method.
| Is This Answer Correct ? | 28 Yes | 6 No |
Answer / akki
Adapter classes are empty implementation of the methods provided by their corresponding interfaces.
if we implements the interface we have to give definition to all methods of interface.
but if we extend adapter class then we will require to define method which we gonna use in our code
| Is This Answer Correct ? | 20 Yes | 5 No |
Answer / vykuntarao
A class which having a methods and those are having dummy
implementation (no implementation).
| Is This Answer Correct ? | 12 Yes | 2 No |
Answer / barkha
An adapter class is a class that provides a dummy (empty)
implementation for an interface. That way someone who wants
to implement the interface but does not want or does not
know how to implement all methods, can use the adapter class
instead, and only override the methods he is interested in.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / hardeep
adapter class are simply the creation of event handler in
certain situation
| Is This Answer Correct ? | 12 Yes | 9 No |
Answer / senthil
we can create our classes as subclasses of one of
the adapter classes, then we need to override only some of
the methods we need. i.e, An adapter classes provide empty
implementation of all methods declared in an EventListener
interface.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / rajat patel
An adapter class is an implementation class of listener interface which contain all methods implemented with empty body.For e.g WindowAdapter is an adapter of WindowListener interface. Adapter class reduce overhead on programming while working with listener interface.
| Is This Answer Correct ? | 2 Yes | 0 No |
What is autoboxing and unboxing?
Features of JAVA ? In which version of java synchronizedXXX() methods are included in Collections class.
What is a string what operation can be performed out with the help of a string?
How do generics work?
Why is multiple inheritance not supported in java?
84. try { 85. ResourceConnection con = resourceFactory.getConnection(); 86. Results r = con.query(”GET INFO FROM CUSTOMER”); 87. info = r.getData(); 88. con.close(); 89. } catch (ResourceException re) { 90. errorLog.write(re.getMessage()); 91. } 92. return info; Which is true if a ResourceException is thrown on line 86? 1 Line 92 will not execute. 2 The connection will not be retrieved in line 85. 3 The resource connection will not be closed on line 88. 4 The enclosing method will throw an exception to its caller.
my method "abc" return array of interface "xyz" and "pqr" is abstract class implements abc and class "jkl" extends pqr My problem 1) when i call abc it retrun array xyz how can i do this hint xyz refer_xyz = new jkl(); but i can't create array. 2)I want to access method of jkl using reference of xyz??
What is java basic concept?
What is OOP's Terms with explanation?
Q) I have a ArrayList object, in that object i have added 5 integer values, 5 float values, 5 string values. Now question is how can delete particular type of data ( i.e all int values or all float values or string values) in that list object at a time?
how can i kill thread without stop() and destroy()
What is constructor chaining and how is it achieved in java?