Java “如何修复错误”;语法错误,请插入";}&引用;要填写“报表”吗;?

Java “如何修复错误”;语法错误,请插入";}&引用;要填写“报表”吗;?,java,drjava,Java,Drjava,发现1个错误: 文件:C:\Users\little\OneDrive\lab_2.java[行:70] 错误:语法错误,请插入“}”以完成语句 我对drjava是新手。我的程序怎么了 import java.util.Scanner; class lab_2 { public static void main (String[]args){ int choice; Scanner myscan=new Scanner(Systemin); boolean didnt

发现1个错误:

文件:C:\Users\little\OneDrive\lab_2.java[行:70] 错误:语法错误,请插入“}”以完成语句

我对drjava是新手。我的程序怎么了

import java.util.Scanner;
class lab_2 { 
  public static void main (String[]args){
   int choice;
    Scanner myscan=new Scanner(Systemin);
    boolean didntquit=true;

   while("didntquit") 
      //show menu
      System.out.println("Please choose an option");
      System.out.println("1)Quadratic Function");
      System.out.println("2)Distance Formula");
      System.out.println("3)Even or Odd");
      System.out.println("4)Factorial");
      System.out.println("5)Fibonacci");
      System.out.println("6)display the digits (in reverse order) of an integer");
      System.out.println("7)Quit Program");

         //get the option

        choice=myscan.nextInt();

        //do the option

        if (choice=7)
          didntquit=false;

        //quitint the program ^^^^

        else if (choice=1){
          int a;
          int b;
          int c;
          System.out.println("what is a ?");
          a=myscan.next ;
         System.out.println("what is b ?");
         b=myscan.next ;
         System.out.println("what is c ?");
         c=myscan.next ;
       double outa =(b + Math.sqrt((b*b)-4*a*c))/(2*a);
       double outa =(b - Math.sqrt((b*b)-4*a*c))/(2*a);   
       }
          //quadratic formula ^^^^

        else if(choice=2){
          System.out.println("What is the x cordinate of the first point?");
          int x1 = myscan.nextInt();
          int x2 = myscan.nextInt();
          int y1 = myscan.nextInt();
          int y2 = myscan.nextInt();
           double dist = Math.sqrt((x2-x1)*2)+((y2-y1)*2);  
        }
             else if (choice=3){
               int x;
                System.out.println("Enter an integer to check if it is even           or odd");
               Scanner in = new Scanner(System.in);
               x =in.nextInt();

               if (x%2==0)
                System.out.println("You entered an even number");
               else
                 System.out.println("You entered an odd number");
       }
             else if (choice=4){
               Scanner scanner = new Scanner(Systemin);
               System.out.println("Enter the number");

               int num =Scanner.nextInt();
                int factorial = fact(num);
               System.out.println("factorial of entered number is: "+factorial);  

             }
             static int fact(int n)
             {
               int output;
               if(n==1)
                 return 1;

               output=fact(n-1)*n;
               return output;
             }
     }

我需要帮助找出这个代码的错误。因为我是初学者,所以它可能不太容易阅读。

main
方法的末尾缺少
}

我可以在代码中看到许多其他问题,其中许多问题被错误的缩进所掩盖。DRJava可以自动修复代码中的缩进;e、 g.使用所述的
IndentFiles
实用程序。我强烈建议你使用它。。。然后看看代码,看看我在说什么


提示:
IndentFiles
之后,缩进看起来不正确,但它会反映代码(如所写)的实际内容。

您的缩进相当随意,很难判断是否正确。我希望您的
while()
需要有一个开头大括号
while(){
。也许可以整理缩进(特别是从
//获取缩进不正确的选项
)然后看看大括号在哪里丢失了?如果语句也有错误,那么有几个
:你需要
=
而不是
=
来测试相等性(但它们不是编译错误的原因,@halfer已经给出了)。我想知道
while(“didntquit”)
是否应该是
while(didntquit)
-如果是布尔值,则不需要引号。您使用的是核心Java还是特殊版本?我没有听说过drjava。