What is anonymous class?
Answers were Sorted based on User's Feedback
Answer / niranjanravi
An Anonymous class is a class which is defined at run time
without having any name and it is instantiated and declared
at the same place.
Syntax:
new class classname(){}
new interface interfacename(){}
Keyword extends and implements are usedin this class.
It is always implicitly final.
It is never static or final.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / rimjhim
it is a local inner class without any name.
it is instantiated at the time of declaration and must be
extended by a class or implemented by an interface.
new [class name](argument list){anonymous class body};
overridden functions can be declared in this calss and it
can have only one new method inside it.more than one can
not be called anywhere.
using dot operator we can call that new function.
| Is This Answer Correct ? | 2 Yes | 1 No |
Difference between String and StringBuffer.
What is string length in java?
State the main difference between c++ and java?
. What are the differences between constructor and method of a class in Java?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
What is supplier in java?
How do you write a scanner class in java?
Can subclass overriding method declare an exception if parent class method doesn't throw an exception?
Why java strings are immutable in nature?
Can we serialize arraylist in java?
What is charat java?
Which are thin and thicK wrapper Class's in Java?