Why do inner class cannot have static declaration except
static nested class?

Answer Posted / vipul

Inner classes share a intimate relationship wth the outer
class which means to instantiate the inner class we need to
obtain the object of the outer class.in any case the inner
class contain any static member then we can access it only
with inner class name in that case we won't require its
object whch means we won't require the outer class
object.but java doesn't allow this if we want to access ny
if the inner class data member we must ahve outer class n
inner class object....queries r most welcomed..

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a treemap in java?

532


What are the differences between the constructors and methods?

569


What is the difference between state-based unit testing and interaction-based unit testing?

491


Write a program to solve producer consumer problem in java?

559


Which collection is thread safe in java?

505






List primitive java types?

588


What will be the initial value of an object reference which is defined as an instance variable?

629


What is integers and example?

486


What is java autoboxing?

530


What are the methods of object class ?

557


What is an empirical question?

535


What are functions in java?

496


Convert a BST into a DLL and DLL to BST in place.

660


Is a class an object?

570


Explain different types of wrapper classes in java?

593