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

Tell us something about set interface.

0 Answers  


Urgent requirement of JAVA/.NET/QA in a CMMI level3 MNC for Pune location.

0 Answers  


Can an interface extands a class?

5 Answers  


What is user defined exception in Java?

0 Answers   TCS,


What is a consumer in java?

0 Answers  


What is meant by tab pans?

0 Answers  


What part of memory - Stack or Heap - is cleaned in the garbage collection process?

1 Answers  


How does the java compiler work?

0 Answers  


What is java basic concept?

0 Answers  


Can you declare an interface method static?

0 Answers  


What do you mean by JVM?

0 Answers   Ericsson,


What is a prefix function.write down a code to compute prefix function.

0 Answers  


Categories