File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes GUI and Strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "GUI and Strings" Watch "GUI and Strings" New topic

GUI and Strings

Graham Robinson

Joined: Nov 23, 2005
Posts: 16
Can't work out how to take them in, I've had it so it will work out the pounds to kilos, but can't seem to send it down. I've tried a few different strimgs etc, here is the code.

Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
Use String.equals() method to compare Strings, not ==

Murad Iqbal
Ranch Hand

Joined: Dec 09, 2003
Posts: 90
1. What are you comparing 'name' and 'kilo' with? 'p' and 'k' are empty strings isnt it? So I suggest initialize them with something you would want to compare them with

2. As told earlier, for String comparison use .equals() method from the String class.
Graham Robinson

Joined: Nov 23, 2005
Posts: 16
Cheers, it works.
I agree. Here's the link:
subject: GUI and Strings