Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Member class vs inner class

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Source: http://blogs.sun.com/darcy/entry/nested_inner_member_and_top

How are member classes different from nested classes (a static or non-static class declared within another class)? Article at the above mentioned link states that:

a member class -> must have a declaring class
an inner class -> must have an enclosing class.

I understand what the static and non-static inner classes are. The following code examples defines a static and non-static inner class.



Can someone please explain what is a member class? I could not make much of the following from the Java Language Specification doc:

8.5 A member class is a class whose declaration is directly enclosed in another class or interface declaration.



cheers
Andy
 
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nested classes are divided into two categories: static and non-static. Nested classes that are declared static are simply called static nested classes. Non-static nested classes are called inner classes or member classes.
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are four types of Inner classes,

1) Member classes/Regular inner classes
2) Method local Inner classes
3) Anonymous Inner classes
4) Static Inner classes.

And, What do you mean by members of a class? It's methods, instance variables? Like that, if a class defined within directly below a Top level class, it(the inner class) is a member of the outer class. So, it's also called as member classes.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic