import java.util.Scanner;
public class JavaApplication1 {
public static void main (String[] args)
{
System.out.println ("You will be prompted to enter the lengths of your triangle, do this in no particular order");
*Scanner sc = new.Scanner(System.in);
}
}
为什么我在标记的Scanner
行上收到错误?我已经做过无数次了。它一直告诉我它需要一个标识符。这是怎么回事?
它应该是
Scanner sc = new Scanner(System.in);
不
Scanner sc = new.Scanner(System.in); // . is invalid
.
应该用空格代替。 也没有*
我犯了一个简单的错误。更正后的代码是:
import java.util.Scanner;
public class JavaApplication1 {
public static void main (String[] args)
{
System.out.println ("You will be prompted to enter the lengths of your triangle, do this in no particular order");
Scanner sc = new Scanner(System.in);
}