I have this button and a text field and i wanted to add value on the variable when the button is clicked everything is working apart from I'm unable to add value to string variable
For example if i put value 20 on tempvalue string it should have 20 and i put 30 it should have 50 but what i get is null2050.
I tried += operator which didn't work.
Isn't there any operator that keep adding value on top it or do i have to write new method ?
private String tempvalue;
btnEnter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String getTxt = textField.getText();
tempvalue += getTxt;
System.out.println(tempvalue);
}
});