This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

inner class  RSS feed

 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


A inner class may be declared static.



Only a non-static nested class in known as inner class.

comment
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A inner class may be declared static.



In this case it will be not inner but top-level nested class, I guess. The point is the inner class can access instance members of outer and top-level nested class cannot.
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the difference between an inner class and nested class?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nested Classes are defined with Static keyword & are considered as Top Level Classes. They don't require the instance of outer class to create their own instance, whereas an inner class is tied to the instance of outer class.

-------------------------------
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


What's the difference between an inner class and nested class?


Here is my contribution to the world of confusion: http://qa.jtiger.org/GetQAndA.action?qids=67&showAnswers=true


Nested Classes are defined with Static keyword & are considered as Top Level Classes.


This is false, a nested class and a top-level class are mutually exclusive entities. A class cannot be nested and top-level at the same time.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!