扫描仪无法解析为类型9

时间:2018-02-25 23:22:06

标签: compiler-errors

我正在尝试编写一个程序,允许用户输入最多两个多项式并且我不断得到"扫描仪无法解析为类型"错误,我不知道如何解决它。这是我的代码:

import java.util.Scanner;
public class Polynomial2
{
   public static double evaluate( double x, double[] coefs)
  {
    int i, coef, deg;
    double total=0, poly;
   Scanner sc= new scanner(System.in);
    System.out.println("Enter degree");
    deg=sc.nextInt();
    System.out.println("Enter x");
    x=sc.nextInt();
    if(coefs !=null)
    {
      for (i=0; i<= deg; i++)
      {
        System.out.println("Enter coefficent for" +i);
        coef=sc.nextInt();
        total= total+coef*Math.pow(x,i);
      }
    } 
    return type (total);
    System.out.println("Total="+total);
  }
}

1 个答案:

答案 0 :(得分:0)

import java.util.Scanner;
Scanner sc= new scanner(System.in);

注意“扫描仪”是如何大写的。您需要将扫描仪大写到新的右侧。

Scanner sc= new Scanner(System.in);