What are inner and anonymous class?

Answers were Sorted based on User's Feedback



What are inner and anonymous class?..

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

What are inner and anonymous class?..

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

What are inner and anonymous class?..

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

Post New Answer

More Core Java Interview Questions

Write a java program to generate fibonacci series ?

0 Answers   Cyient,


What is a type parameter in java?

0 Answers  


What are the uses of synchronized keyword?

0 Answers  


whar are the draw backs of programming lang step by step in Clang and next in C++ and next and in Java nad in .Net

0 Answers  


what is sendredirect?

7 Answers   TCS,






What is mvc in java?

0 Answers  


Write a program to check for a prime number in java?

0 Answers   Cyient,


How to sort array in descending order in java?

0 Answers  


How do you sort in java?

0 Answers  


What is not thread safe?

0 Answers  


could you run the java program without main method?

6 Answers  


What is difference between public static and void?

0 Answers  


Categories