Skip to content

Commit a874844

Browse files
author
Ram swaroop
committed
added content
1 parent 7f65add commit a874844

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

_posts/2015-08-20-nested-classes.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,14 @@ class Outer {
238238

239239
### What a Method-Local Inner Object Can and Can't Do
240240

241-
242-
243-
241+
A method-local inner class can be instantiated only within the method where the inner class is defined. In other words,
242+
no other code running in any other method inside or outside the outer class can ever instantiate the method-local
243+
inner class.
244+
245+
Can |Cannot
246+
----------------|----------------
247+
Access private members of the outer/enclosing class. | Cannot use the local variables of the method the inner class is in.
248+
The only modifiers you can apply to a method-local inner class are abstract and final, but, as always, never both at the same time. | You can't mark a method-local inner class public, private, protected, static, transient (just like a variable).
249+
250+
244251

0 commit comments

Comments
 (0)