RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting

non-static and variable errors

Join Date: Sep 2004
Location: Rotterdam, The Netherlands
Posts: 24
Reputation: DeepZ is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
DeepZ's Avatar
DeepZ DeepZ is offline Offline
Newbie Poster

Re: non-static and variable errors

  #5  
May 5th, 2006
If your method2 needs to work on data in a variable defined/declared (or whatever) in method1 you need to pass it as a argument.

JWenting is right though, have a look at your design. It looks like the Schedule object is the heart. So decide which data values are making up that object (like time, day, film tec.) and make these data-elemenst instance variables (like ch1Time and ch2Time are now). This will make them available to all instance methods.

Then if method2 needs to work on variable i declared/initialised in method1 you need to do something like :
         method2(i);
in your method1 and declare method2 as method2(int i) or whatever the variable type is.

Hope this helps,
Guido
:?: Sometimes i wonder if i'm on the right planet :!:
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:12 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC