Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
    Bookmark Topic Watch Topic
  • New Topic

help please...  RSS feed

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Report post to moderator
This may sound easy to you that's why I need your help. How do I use a string value from one class to another class?

Example: I have a string in class A and I want to use it for a decision in class B. How do I do that? Will you help me?

Thanks.
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Report post to moderator
One way would be to make a public method to retrieve the string from class A. For example, say this simple class which represents a person was your 'A' class:


Then in your 'B' class you would call the getName() method to find out the value of the name variable. Something like this:

[ June 10, 2005: Message edited by: Stuart Gray ]
 
author and iconoclast
Sheriff
Posts: 24219
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Dupe. See Here.
 
I've never won anything before. Not even a tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!