无法弄清楚如何解决。我对Java非常陌生。错误:字符串无法解析为变量
import java.util.Scanner;
public class Greetings {
public static void main(String[] args) {
System.out.println("Hello there, what is your name? ");
Scanner input = new Scanner(System.in);
String = input.nextLine();
System.out.println("Well then, welcome to Java" + input);
}
}
请在此行声明变量,String = input.nextLine();因为你需要存储一个字符串类型的变量。 String s = input.nextLine(); – Kogile
@Unheilig请避免添加不相关的标签,谢谢。 – Tom