这似乎是一个愚蠢的问题.如何打印if语句?
private void btnCheckMouseClicked(java.awt.event.MouseEvent evt) {
String height;
height = heightCm.getText();
if ((height >=122) && (height <=188)){
outputCheck.setText("WORKING...");
}
}
Run Code Online (Sandbox Code Playgroud)
您需要将高度转换为整数.然后,您将能够在if语句中进行比较.
int height = Integer.parseInt(heightCm.getText());
Run Code Online (Sandbox Code Playgroud)