import javax.swing.*;
public class Test
{
int num1,num2;
while(true)//illegal start of type
{
num1=Integer.parseInt(JOptionPane.showInputDialog("Enter a number please:"));
num2=Integer.parseInt(JOptionPane.showConfirmDialog("Enter another number please:"));
if(num2!=0&&num1/num2>=10)
System.out.println(num1/num2);
else
System.out.print("The result is less than 10!");}
}//<identifier> expected谢谢!!!

解决方案 »

  1.   

    我添加了一个main()函数后,又出现了一个错误:import javax.swing.*;
    public class Test
    {
        public static void main(String args[])
          {

            int num1,num2;
    while(true)
    {
    num1=Integer.parseInt(JOptionPane.showInputDialog("Enter a number please:"));
    num2=Integer.parseInt(JOptionPane.showConfirmDialog("Enter another number please:"));//cannot result symbol method showConfirmDialog(java.lang.String)
    if(num2!=0&&num1/num2>=10)
    System.out.println(num1/num2);
    else
    System.out.print("The result is less than 10!");
    }
    }
    }
    这是什么错误呀?谢谢!!
      

  2.   


    showConfirmDialog
    改成
    showInputDialog