S
snehaltiwari
Hi all,
I am a newbie in java and have prior OO experience in PB and .Net.
The term "static" means that a class member belongs to the definiton
and not the instance. i.e. it is shared across all instances.
Then, why does the language allow for "static" nested classes which
need to be instantiated to be used??
As far as I understand, the resoning behiend nested classes is to group
functionality into related classes (reducing no of external classes),
increase encapsulation and having more readable code.
As we design our applications, why would we need a nested class (i.e.
static) that is not tied to its parent instantance?
It seems, having a static nested class is equivalent to having a top
level class without any specific language/programming features.
It feel it would only increases complexity in understanding and
implementing them.
Please correct me if I am wrong in my underrstanding.
Would be great to have any comments from ppl having used/implemented
nested classes.
Regards
I am a newbie in java and have prior OO experience in PB and .Net.
The term "static" means that a class member belongs to the definiton
and not the instance. i.e. it is shared across all instances.
Then, why does the language allow for "static" nested classes which
need to be instantiated to be used??
As far as I understand, the resoning behiend nested classes is to group
functionality into related classes (reducing no of external classes),
increase encapsulation and having more readable code.
As we design our applications, why would we need a nested class (i.e.
static) that is not tied to its parent instantance?
It seems, having a static nested class is equivalent to having a top
level class without any specific language/programming features.
It feel it would only increases complexity in understanding and
implementing them.
Please correct me if I am wrong in my underrstanding.
Would be great to have any comments from ppl having used/implemented
nested classes.
Regards