Ниже мой код, я пытаюсь проверить, является ли xCoord пустой или пустой, поэтому я могу сделать исключение. Как мне это сделать? Я попытался с try/catch, если xCoord == null, но это не сработает.Проверка, является ли поле пустым
String x = JOptionPane.showInputDialog("X Coordinate", "Enter an x coordinate");
int xCoord = Integer.parseInt(x);
String y = JOptionPane.showInputDialog("Y Coordinate", "Enter a y coordinate");
int yCoord = Integer.parseInt(y);
String width = JOptionPane.showInputDialog("Radius", "Enter the length of the radius");
int radius = Integer.parseInt(width);
только 'Objects' может быть пустым – ControlAltDel
' int' никогда не может быть пустым, используйте 'Integer' вместо или проверить' х == null' и т.д. – Thomas