You’re already using an if
statement. That’s the key to what you want.
int a = Integer.parseInt(cijenaIgraca.getText());
int b = Integer.parseInt(kapital.getText());
if(b < a) {
this.porukica.setText("Usli ste u minus, imacete troskove!");
} else {
String c = String.valueOf(b-a);
this.kapital.setText(c);
}
Just add an else
part as shown so the subtraction will only happen in that case.
0
solved How to stop substraction if that is not possible? [closed]