程序没有错,但是显示errors exit in required projects

package
exercise;

import
javax.swing.JOptionPane;

public class 对话框 {

public static void main(String[] args) {

JOptionPane.showMessageDialog(null, “你真是一个帅气的人!”);

int n = JOptionPane.showConfirmDialog(null, “你确定要退出吗?”);

if (n == 0) {

System.out.println(“你点的是确定?”);

} else

System.out.println(“你竟然选择取消?”);

first: {

String str = JOptionPane.showInputDialog(“请输入一个整数:”);

if (str == null)

break first;

n = Integer.parseInt(str);

System.out.println(“你输入的是:” + n);

System.exit(0);

}

// 如果点错取消,可以再次进行输入

String str2 = JOptionPane.showInputDialog(“请输入一个整数:”);

if (str2 == null) {

return;

} else {

n = Integer.parseInt(str2);

System.out.println(“你输入的是:” + n);

}

}

}

猜你喜欢

转载自blog.csdn.net/qq_43270410/article/details/82829313