I want my code to catch if the user didn't input anything. I can't use ab.equals(null), ab.isEmpty() because I convert the String to integer as you can see.
import javax.swing.JOptionPane;
public class Mango {
public static void main (String[] args){
String ab = JOptionPane.showInputDialog("Enter Anything");
double sum = 0;
double x = Integer.parseInt(ab);
if(x <= 0){
System.out.println("Empty!");
}else{
sum+=x;
}
}