• Post Reply Bookmark Topic Watch Topic
  • New Topic

Static nested class  RSS feed

 
Vlada Den
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Here is the code:

My question is: what is the advantage of using a static nested class here?

Thanks!

Vlada
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The nested class implies that there is some kind of relationship with the outer class. In this case, the StackOfInts class uses the inner Node class to store the internal linked list.

Layne
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!