我需要帮助从键盘生成无限字符串,但这不起作用..
Scanner input = new Scanner(System.in);
ArrayList<String> al = new ArrayList<String>();
String check=null;
while(true){
check = input.nextLine();
if(check == "stop") break;
al.add(check);
}
System.out.println(al);
}
}