So I am obviously missing something completely obvious here. I have a button and an actionlistener hooked up to it. When I click the button, I want run an if statement that takes the contents of a TextArea and compares it to a String. Like So:
String a = "hello";
JTextArea area = new JTextArea("type something");
JButton button = new JButton("Go");
button. [insert actionlistener crap]
//here's the important part:
if (area.getText() == "hello"){
//this will not be executed
}
It's really weird. I even went through the debugger and at that if statement, both of those items are "hello". But it skips over it! What am I doing wrong?
EDIT: a lot of you are saying "use .equals". Can anyone tell me why?