所以我在学习java,一点一点地获得更多的知识,现在我在关注tutroials和其他webistes ect学习,但我陷入了一个我无法弄清楚问题所在的问题。
import java.util.Scanner;
class apples{
public static void main(String args[]){
System.out.print("Player Name?");
Scanner name = new Scanner(System.in);
System.out.print(name.nextLine());
System.out.print(" ,how old are you?");
Scanner age = new Scanner(System.in);
System.out.print(age.nextLine());
if (age >= 15){
System.out.println("welcome to Azura World");
}else{
System.out.println("insufficient experience");
}
}
}
从这应该做的是,询问玩家姓名,我键入它应该询问姓名,你几岁?有了这个,我有了输入的年龄,因为我想在 if 语句中使用它,但它不起作用,我不明白为什么。所以如果有时间请解释一下。
我现在也使用这个作为指南