This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes help please... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

help please...

Lawrence Buensalida
Ranch Hand

Joined: May 18, 2005
Posts: 38
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.
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
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 ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24190
    
  34

Dupe. See Here.


[Jess in Action][AskingGoodQuestions]
 
Have you checked out Aspose?
 
subject: help please...
 
It's not a secret anymore!