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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / adithya

Static have only one copy in memory. For class we have to
create objects. But for static we cannot create.

Is This Answer Correct ?    7 Yes 9 No

Post New Answer

More Core Java Interview Questions

What is * argv?

0 Answers  


What is JVM ?

4 Answers   Phantom Technologies, TCS,


What are the steps that are followed when two computers connect through tcp?

0 Answers  


When object is created and destroyed?

0 Answers  


What is a singleton in genetics?

0 Answers  






What are user defined exceptions?

0 Answers  


How does marker interface provides functionality to the implemented class ? or How dose maker interface gets the functionalities as serialization or cloning.

4 Answers   Cap Gemini,


When we serialize an object does the serialization mechanism saves its references too?

0 Answers  


What is scope & storage allocation of static, local and register variables? Explain with an example.

0 Answers   IBS,


Explain about member inner classes?

0 Answers  


Is java hashset ordered?

0 Answers  


What is thread count in java?

0 Answers  


Categories