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
行上收到错误消息?我无数次地完成了这件事。它一直告诉我它需要一个标识符。发生了什么事?
答案 0 :(得分:1)
应该是
Scanner sc = new Scanner(System.in);
不
Scanner sc = new.Scanner(System.in); // . is invalid
.
应该替换为空格。没有*
以及
答案 1 :(得分:0)
我犯了一个简单的错误。更正的代码是:
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);
}