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 keyword and identifier?

0 Answers  


what is associative array

1 Answers   Tech Mentro,


Name the method of a Container that can be used to cause a container to be laid out and redisplayed?

1 Answers  


How big is a pointer?

0 Answers  


Difference between java and javascript

0 Answers  






What are the object and class classes used for?

0 Answers  


how can you catch multiple exceptions in java?

0 Answers   Cyient,


Why is multiple inheritance not supported in java?

0 Answers  


Features of JAVA ? In which version of java synchronizedXXX() methods are included in Collections class.

1 Answers   NIIT,


What is a loop java?

0 Answers  


Explain about OOPS concepts and fundamentals.

0 Answers   Syntel, Visa,


What is the purpose of checked and unchecked exceptions in JAVA?

0 Answers   Amdocs,


Categories