<s>
In	O
object-oriented	B-Language
programming	I-Language
(	O
OOP	O
)	O
,	O
an	O
inner	B-Language
class	I-Language
or	O
nested	B-Language
class	I-Language
is	O
a	O
class	O
declared	O
entirely	O
within	O
the	O
body	O
of	O
another	O
class	O
or	O
interface	B-Application
.	O
</s>
<s>
By	O
contrast	O
,	O
an	O
instance	O
of	O
an	O
inner	B-Language
class	I-Language
cannot	O
be	O
instantiated	O
without	O
being	O
bound	O
to	O
a	O
top-level	O
class	O
.	O
</s>
<s>
We	O
can	O
refer	O
to	O
our	O
Wheel	O
class	O
as	O
Car.Wheel	O
,	O
Car	O
being	O
the	O
top-level	O
class	O
and	O
Wheel	O
being	O
the	O
inner	B-Language
class	I-Language
.	O
</s>
<s>
Larger	O
segments	O
of	O
code	O
within	O
a	O
class	O
might	O
be	O
better	O
modeled	O
or	O
refactored	O
as	O
a	O
separate	O
top-level	O
class	O
,	O
rather	O
than	O
an	O
inner	B-Language
class	I-Language
.	O
</s>
<s>
In	O
Java	B-Language
there	O
are	O
four	O
types	O
of	O
nested	B-Language
class	I-Language
:	O
</s>
<s>
static	O
methods	O
)	O
,	O
they	O
do	O
not	O
have	O
an	O
enclosing	O
instance	O
,	O
and	O
cannot	O
access	O
instance	B-Application
variables	I-Application
and	O
methods	O
of	O
the	O
enclosing	O
class	O
.	O
</s>
<s>
They	O
are	O
almost	O
identical	O
to	O
non-nested	O
classes	O
except	O
for	O
scope	O
details	O
(	O
they	O
can	O
refer	O
to	O
static	B-General_Concept
variables	I-General_Concept
and	O
methods	O
of	O
the	O
enclosing	O
class	O
without	O
qualifying	O
the	O
name	O
;	O
other	O
classes	O
that	O
are	O
not	O
one	O
of	O
its	O
enclosing	O
classes	O
have	O
to	O
qualify	O
its	O
name	O
with	O
its	O
enclosing	O
class	O
's	O
name	O
)	O
.	O
</s>
<s>
Inner	B-Language
class	I-Language
The	O
following	O
categories	O
are	O
called	O
inner	O
classes	O
.	O
</s>
<s>
Hence	O
,	O
they	O
can	O
implicitly	O
refer	O
to	O
instance	B-Application
variables	I-Application
and	O
methods	O
of	O
the	O
enclosing	O
class	O
.	O
</s>
<s>
Inner	O
classes	O
may	O
not	O
have	O
static	B-General_Concept
variables	I-General_Concept
or	O
methods	O
,	O
except	O
for	O
compile-time	O
constant	O
variables	O
.	O
</s>
<s>
Local	B-Language
class	I-Language
These	O
are	O
classes	O
that	O
are	O
declared	O
in	O
the	O
body	O
of	O
a	O
function	O
.	O
</s>
<s>
(	O
This	O
is	O
because	O
the	O
local	B-Language
class	I-Language
instance	O
must	O
maintain	O
a	O
separate	O
copy	O
of	O
the	O
variable	O
,	O
as	O
it	O
may	O
out-live	O
the	O
function	O
;	O
so	O
as	O
not	O
to	O
have	O
the	O
confusion	O
of	O
two	O
modifiable	O
variables	O
with	O
the	O
same	O
name	O
in	O
the	O
same	O
scope	O
,	O
the	O
variable	O
is	O
forced	O
to	O
be	O
non-modifiable	O
.	O
)	O
</s>
<s>
They	O
can	O
only	O
directly	O
extend	O
one	O
class	O
or	O
implement	O
one	O
interface	B-Application
.	O
</s>
<s>
Inner	O
classes	O
became	O
a	O
feature	O
of	O
the	O
Java	B-Language
programming	I-Language
language	I-Language
starting	O
with	O
version	O
1.1	O
.	O
</s>
<s>
Nested	O
classes	O
are	O
also	O
a	O
feature	O
of	O
the	O
D	B-Application
programming	I-Application
language	I-Application
,	O
Visual	B-Language
Basic	I-Language
.NET	I-Language
,	O
Ruby	O
,	O
C++	B-Language
and	O
C#	O
.	O
</s>
<s>
In	O
Python	B-Language
,	O
it	O
is	O
possible	O
to	O
nest	O
a	O
class	O
within	O
another	O
class	O
,	O
method	O
or	O
function	O
.	O
</s>
<s>
C++	B-Language
has	O
nested	O
classes	O
that	O
are	O
like	O
Java	B-Language
's	O
static	O
member	O
classes	O
,	O
except	O
that	O
they	O
are	O
not	O
declared	O
with	O
"	O
static	O
"	O
.	O
</s>
<s>
BETA	B-Language
language	O
introduced	O
this	O
notion	O
of	O
nested	O
classes	O
.	O
</s>
<s>
Local	O
inner	O
classes	O
are	O
often	O
used	O
in	O
Java	B-Language
to	O
define	O
callbacks	O
for	O
GUI	O
code	O
.	O
</s>
<s>
Components	O
can	O
then	O
share	O
an	O
object	O
that	O
implements	O
an	O
event	O
handling	O
interface	B-Application
or	O
extends	O
an	O
abstract	O
adapter	O
class	O
,	O
containing	O
the	O
code	O
to	O
be	O
executed	O
when	O
a	O
given	O
event	O
is	O
triggered	O
.	O
</s>
<s>
This	O
type	O
of	O
code	O
is	O
often	O
considered	O
messy	O
and	O
the	O
inner	B-Language
class	I-Language
variations	O
are	O
considered	O
to	O
be	O
better	O
in	O
all	O
regards	O
.	O
</s>
