|
INTERVIEW QUESTIONS
J2EE
JAVA
DETAILS
Question: How to create the object to the anonomous class
Answer: Anonymous classes are classes that don’t have a name (hence the term anonymous). Because they don’t have a name, there is no way to refer to them. For this reason, their declaration must be given at creation time, as part of the new statement.That requires yet another form of the new statement, as follows:new This form of the new statement declares a new anonymous class that extends a given class or implements a given interface. It also creates a new instance of that class and returns it as the result of the statement. The class to extend or the interface to implement is the operand of the new statement, followed by the anonymous class’ body.
|
|
|
Category |
Java Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 6749 users |
Added on |
8/14/2011 |
Views |
68439 |
Rate it! |
|
|
Question:
How to create the object to the anonomous class
Answer:
Anonymous classes are classes that don’t have a name (hence the term anonymous). Because they don’t have a name, there is no way to refer to them. For this reason, their declaration must be given at creation time, as part of the new statement.That requires yet another form of the new statement, as follows:new This form of the new statement declares a new anonymous class that extends a given class or implements a given interface. It also creates a new instance of that class and returns it as the result of the statement. The class to extend or the interface to implement is the operand of the new statement, followed by the anonymous class’ body. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What is the difference between array list and linked list. in which situations we are use them? which is best one?
|
View Answer
|
|
Can i expand an interface?
|
View Answer
|
|
what happens if we execute the program? class Return{ int display(){ try{ return 1; } finally{ return 2; } } public static void main(String args[]){ Return r=new Return(); r.display(); } }
|
View Answer
|
|
If interface has got four methods,and I like to implement only two methods, how this could be achieved?
|
View Answer
|
|
Does JVM maintain a cache by itself? Does the JVM allocate objects in heap? Is this the OS heap or the heap maintained by the JVM? Why
|
View Answer
|
|
What are the primitive types in Java?
|
View Answer
|
|
How would you implement a thread pool
|
View Answer
|
|
How do you declare constant values in java?
|
View Answer
|
|
Do primitive types have a class representation
|
View Answer
|
|
When you have an object passed to a method and when the object is reassigned to a different one, then is the original reference lost
|
View Answer
|
|
What is a memory footprint? How can you specify the lower and upper limits of the RAM used by the JVM? What happens when the JVM needs more memory
|
View Answer
|
|
When you use a struts framework, where would you place your business logic
|
View Answer
|
|
How all can you free memory
|
View Answer
|
|
Does java do reference counting
|
View Answer
|
|
What does a static inner class mean? How is it different from any other static member
|
View Answer
|
|
What are the differences between JIT and HotSpot
|
View Answer
|
|
What are the disadvantages of reference counting in garbage collection
|
View Answer
|
|
What is EJB
|
View Answer
|
|
What is the sweep and paint algorithm
|
View Answer
|
|
What is reflection API? How are they implemented
|
View Answer
|