• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call a variable from a different class  RSS feed

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a very newb question and i feel dumb asking it because i have been using java for months but, how do you call a variable from a different class?

thanks!
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. The best way to do it is thru a accessor method


so..

2. I suppose you can also declare your variable as public, But this is NOT a good practice.


 
Cody Long
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so very much!!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!