Ok, I know I'm going to feel dumb when I get an answer to this, but here it goes. I need to create an inner class and have it encapsulate stuff. Well uhm....how do you create an inner class. I've looked at documentation here and on sun.java. but I still don't get it. Any help would be greatly appreciated. Thanks chris
I need to use an inner class to create get and set methods for 3 instance variables. The inner class will also have a constructor to insantiate an object using the received values of the 3 variables Chris
I need to use an inner class to create get and set methods for 3 instance variables.
this is not a good reason. The get and set methods you create in an inner class will only be accessable by the outer class. No other class will be able to use them, even if they are declared 'public'. But here is an example:
Other people can jump in here and explain why this code doesn't really do anything for you.
Please ignore post, I have no idea what I am talking about.
Joined: Dec 10, 2001
The get and set methods you create in an inner class will only be accessable by the outer class. No other class will be able to use them, even if they are declared 'public'. That's not really true. Were the inner class private, then it and its members would not be accessible from outside of the enclosing (outer) class. [ October 24, 2002: Message edited by: Dirk Schreckmann ]
Joined: Oct 02, 2002
Ok, Well I only need the Outter class to get the information from the inner class, so that is not a concern. The app i'm writing only has the one class. As far as some code this is what i've got going so far with it.
I know there is more to set and get then that, and i know i need to declare variables, but i understand that. I'm just curious, if i'm setting up the outter inner class thing right. thanks Chris