I was wondering if I could get some help to make my if
statements more compact. For example making these if-statements into one if possible with using &&
or something. The different buttons have different values.
public void actionPerformed(ActionEvent ae) {
if(ae.getSource() == button[14])
clear();
if(ae.getSource() == button[15])
getSqrt();
if(ae.getSource() == button[16])
getPosNeg();
if(ae.getSource() == button[17])
getResult();
if(ae.getSource() == button[18])
display.append("0");
}
Aucun commentaire:
Enregistrer un commentaire