java - How can I access the variables of an inner class? -
class outer{ int c, void values() { inner.a=3; inner.b=4; } void addvalues() { **inner.a += c;** // **how can access value of a=3 values() method?** } class inner{ int a,b; } }
1) need instance of inner
that
or
2) can declare inner
static
, make variable a
static
Comments
Post a Comment