import javax.swing.JOptionPane;
public class DemoJOptionPane {
public static void main(String[] args) {
String mess = "";
int i;
do {
try {
String str = JOptionPane.showInputDialog("Nhap so nguyen");
int n = Integer.parseInt(str);//ep kieu
mess = (n % 2 == 0) ? "So chan" : "So le";
JOptionPane.showMessageDialog(null, mess);
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(null,"Nhập sai dữ liệu!", "Chú ý nè",JOptionPane.ERROR_MESSAGE);
}
i=JOptionPane.showConfirmDialog(null, "Bạn có muốn tiếp tục chương trình không?", "Tui hỏi bạn đó", JOptionPane.YES_NO_OPTION);
} while (i==JOptionPane.YES_OPTION);
}
}