Java 数据类型不相同

来源:百度知道 编辑:UC知道 时间:2024/05/31 23:15:15
import javax.swing.JOptionPane;
class mathException extends Exception
{
mathException()
{
System.out.println("输入数据部正确");
}
}
class Exception4
{
public static String name;
public static int pay;
public static void inputdata() throws mathException
{
try
{
name=JOptionPane.showInputDialog("请输入您的姓名");
if(name.equals("")) throw new Exception();
pay=Integer.parseInt(JOptionPane.showInputDialog("请输入您的工资"));
if(pay<0) throw new mathException();

}
catch(exception e)
{
System.out.println("(e)");
System.exit(0);
}
}
public static void main(String [] args)
{
try
{
for(int i=1;;i++)
{

【【【【下面代码测试可以运行】】】】
import javax.swing.JOptionPane;

class mathException extends Exception
{
mathException()
{
System.out.println("输入数据部正确");
}
}
public class Exception4
{
public static String name;
public static int pay;
public static void inputdata() throws mathException
{
try
{
name=JOptionPane.showInputDialog("请输入您的姓名");
if(name.equals("")) throw new Exception();
pay=Integer.parseInt(JOptionPane.showInputDialog("请输入您的工资"));
if(pay<0) throw new mathException();

}
catch(Exception e)
{
System.out.println("(e)");
System.exit(0);
}
}
public static void main(String [] args)
{
try
{
fo