nextLine就是不让我输入,怎么解决?
程序代码:import java.util.Scanner;
class TestJava{
public static void main(String[] args){
Scanner stdIn=new Scanner(System.in);
// System.out.println("读取各种类型的数:");
// System.out.print("byte型的b:");
// byte b=stdIn.nextByte();
// System.out.print("short型的s:");
// short s=stdIn.nextShort();
// System.out.print("int型的i:");
// int i=stdIn.nextInt(); //输入的数不是整数试试
// System.out.print("long型的l:");
// long l=stdIn.nextLong();
// System.out.print("float型的f:");
// float f=stdIn.nextFloat();
// System.out.print("double型的d:");
// double d=stdIn.nextDouble();
// System.out.println("b+s+i+l = " + (b+s+i+l));
// System.out.println("f+d = " + (f+d));
System.out.print("您的姓名是:");
String str=stdIn.next(); //输入的字符符,中间有空格试试
System.out.println("你好" + str + "。");
System.out.println("请输入有空格间隔的两串字符串试试:"); //难道必须另起一行?
String strline=stdIn.nextLine(); //这里再输入有空格间隔的字符串试试
System.out.println("你输入的行的内容是:" + strline);
System.out.print("请输入逻辑值:");
boolean boolValue=stdIn.nextBoolean();
System.out.println("你输入的逻辑值是:" + boolValue);
}
}哪里出错?对照了好几遍,https://blog.,没看出问题。
nextLine就是不允许我来输入。









