I created this code to check whether the text field of calculator has any content. If content is present in the text field, then it should display "."
. Otherwise, it should display "0."
in the text field. The problem is that the if condition always evaluates to false.
private void dotActionPerformed(ActionEvent evt){
String dott=display.getText();
if(dott==null)
{
display.setText(display.getText()+"0.");
}
else
{
display.setText(display.getText()+dot.getText());
}
}