What are inner and anonymous class?
Answers were Sorted based on User's Feedback
Answer / janet
Inner Class: classes defined in other classes ,including
those defined in methods are called inner classes.
An inner class can have any accessiblity including private.
Anonumous class: Anonymous class is a class defined inside
a method without a name and is instantiated and declared in
the same place and cannot have explicit constructors.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sathya
Inner classes as name suggests, can be declared within a
class, as for that matter, with in a for statement too... or
with in a method of another class.
Anonymous classes are also inner classes but without a name,
The advantage being more abstraction of code, but more
confusing to beginners
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / harika.thota001@gmail.com
Inner Class in java so called nested class is nothing but a class that is being defined inside another class. Inner classes are beneficial in two scenarios i.e. access control and naming control. Although these benefits can be acquired using java packages.
anonymous class is an inner class that does not have a name at all. And whose instance is being created at the time of its creation.
| Is This Answer Correct ? | 0 Yes | 0 No |
Does substring create a new object?
What are the drawbacks for singleton class?
In collection sorting comparable and comparator interface will be used..but why this two interfaces required..two will work same purpose so why there are two interfaces instead of one?when to use comparator and when to use comparable?
Is java developer a good career?
How many inner classes can a class have?
what is aberivation of java?
Does string isempty check for null?
What is a null point?
Can we catch more than one exception in a single catch block?
What is a flag variable?
Do you know why doesn't the java library use a randomized version of quicksort?
To set the position and size of a component, which methods are used?