What is static and a non-static inner class?
Answers were Sorted based on User's Feedback
Answer / guest
Non Static inner classes have object instances that are
associated with the classes outer class.Static inner
classes have no object instances.
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / karthee
Static inner class
can only access the static members of the enclosing class.
not associated with the instance of the enclosing class.
can only have static members.
Nonstatic class
is associated with the instance of the enclosing class.(we
need it first to access the nonstatic class)
can access all the member of the encosing class.
is like other members of the enclosing class.
| Is This Answer Correct ? | 2 Yes | 0 No |
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 |
How do you join strings in java?
What are keyboard events?
What is set in java?
What is the difference between Trusted and Untrusted Applet ?
why java not supproting multiple inheritance?
What will happen if we declare don’t declare the main as static?
Is there memory leaks in java?
Tell us something about set interface.
what is difference between class and object?
43 Answers College School Exams Tests, HCL,
Is a class subclass of itself?
What are register variables what are the advantages?
In what ways you can handle exception ?