wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes inner class program - giving error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "inner class program - giving error" Watch "inner class program - giving error" New topic
Author

inner class program - giving error

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830


can any body tell why the program is giving error . inner class object can access all the member of outer class then why .... ???

thanks a lot .
[ January 11, 2005: Message edited by: rathi ji ]
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
I think you should define one method inside inner class,call that integer there and then call the method.


MH
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Inner does not have a member called i.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Barry Gaunt:
Inner does not have a member called i.


yes but inner class have access of outer class members . Is this is like that we have to access that member in inner class scope only ...

please reply ...

thanks .
[ January 11, 2005: Message edited by: rathi ji ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
You cannot ask an instance of Inner what its member i is, because it does not have one. But you can give it a method, getI() say, that returns the value of i from the containing class.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Thanks barry & all ,
I got the point ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inner class program - giving error