inner class

does inner classes share information with each others?

Page 1 of 1

5 Replies - 615 Views - Last Post: 19 February 2010 - 03:07 PM Rate Topic: -----

#1 obviousninja  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 68
  • Joined: 17-February 10

inner class

Posted 18 February 2010 - 07:17 AM

if i have a outer class, and inside this outer class there are many inner classes.
do the inner classes in this outer class share any information with each other or are they just stand alone by themselves??
Is This A Good Question/Topic? 0
  • +

Replies To: inner class

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10785
  • View blog
  • Posts: 40,160
  • Joined: 27-December 08

Re: inner class

Posted 18 February 2010 - 07:29 AM

They stand by themselves, just as methods do. Just like no one method knows how the operates, each inner class doesn't know how the others work, only that they do if you choose to have them interact.
Was This Post Helpful? 0
  • +
  • -

#3 obviousninja  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 68
  • Joined: 17-February 10

Re: inner class

Posted 18 February 2010 - 07:42 AM

View Postmacosxnerd101, on 18 February 2010 - 06:29 AM, said:

They stand by themselves, just as methods do. Just like no one method knows how the operates, each inner class doesn't know how the others work, only that they do if you choose to have them interact.


thanks. ^_^
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10785
  • View blog
  • Posts: 40,160
  • Joined: 27-December 08

Re: inner class

Posted 18 February 2010 - 08:18 AM

Glad I could help! :)
Was This Post Helpful? 0
  • +
  • -

#5 YasuoDancez  Icon User is offline

  • D.I.C Head

Reputation: 20
  • View blog
  • Posts: 135
  • Joined: 30-September 09

Re: inner class

Posted 18 February 2010 - 10:09 PM

View Postmacosxnerd101, on 18 February 2010 - 06:29 AM, said:

They stand by themselves, just as methods do. Just like no one method knows how the operates, each inner class doesn't know how the others work, only that they do if you choose to have them interact.


Although, I'm pretty sure InnerClasses share Instance Variables of the outerClass.
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: inner class

Posted 19 February 2010 - 03:07 PM

View PostYasuoDancez, on 18 February 2010 - 11:09 PM, said:

View Postmacosxnerd101, on 18 February 2010 - 06:29 AM, said:

They stand by themselves, just as methods do. Just like no one method knows how the operates, each inner class doesn't know how the others work, only that they do if you choose to have them interact.


Although, I'm pretty sure InnerClasses share Instance Variables of the outerClass.

Yes you are right
class Abc
   private int nb;
...

   class Inner {
      void aMethod() {
          nb = 10;   // yes I can access my outer class variables
      }
   }
}


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1