What is static and a non-static inner class?

Answer Posted / p.nandakishore

non static inner classes can access all the members of the
outer class i.e both static and nonstatic members.In
nonstatic inner classes we cannot have static declarations
done.To access non static inner class members we outer
class reference.

static inner classes can access only static members of the
outer class.In static inner class we can have static
declarations done. To access static inner class members
no need of outer class reference.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How would you dynamically allocate memory to an array?

782


What is a singleton in genetics?

786


Are maps ordered java?

694


What is port number in java?

786


What all access modifiers are allowed for top class ?

939


How are java objects passed to a method and what are native methods?

810


Outline the major features of java.

789


Is 0 true or is 1 true?

701


When parseint method can be used?

710


What is hashing principle in java?

770


What class allows you to read objects directly from a stream?

1104


Can a class with private constructor be extended?

688


How does singleton class work?

732


What is a loop java?

790


Are true and false keywords?

781