Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Transfer and Store multiple values?

 
Avin Sinanan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello i am having problem doing the following.. consider the situation :
1)Ok lets assume i have 2 classes. Two Seperate classes.
2)Ok each class allows the user to input 2 string values. There each class produces a String value.
3)Now lets assume we have a 3rd Class. Now the purpose of this 3rd class is to compare the two String values from each class.
4)Hence the string value from each class must be sent to the 3rd class. And the 3rd class must store these values and then compare them. If the two String vales are the same the program prints " they are the same"
If they are diffrent the program prints "they are different".
5)I can already make classes 1 and 2. However i am having problems creating the 3rd class. how do i do this? Do i need to create a JList or a Matrix. I'ce tried both and well i have failed. Does anyone out there have any ideas? Please let me know.Any knod of help would be appreciated. Thanks.
Thanks Avin Sinanan
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this is what you are wanting, but a simple solution would be to have a getString() method in your two classes, have your third class instantiate objects of those two classes, and call this method. Then use the equals() method from the String class to see if they are the same.
Jason
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic