0

So, I have a small application and I made an "extra" JTextField for the user to input Yes or No if he wants extra data.

I use this method:

process(file.getText(), Integer.parseInt(aText.getText()),
                    Integer.parseInt(bText.getText()), cText.getText(),
                    dText.getText()); //dText is the one I have problems with

In

public void process(String name, int a, int b, String obs, String extra) { ... }

I wrote this

if(extra== "yes"){
            writer.write("Success!");
        }

but it is not working.

If I was to write just

writer.write(extra);

it would have worked, by that it means that it can read the text I input but still I can't use the If-statement. Am I doing something wrong or that is not possible at all?

here is my full code : http://pastebin.com/esw302uD

Sorry for my bad english.

roboticonx8
  • 39
  • 1
  • 11

1 Answers1

1

Use extra.equals("yes") instead of extra== "yes"

Tkachuk_Evgen
  • 1,334
  • 11
  • 17