我已经实现了以下代码以小写字符打印短语:
import java.util.Scanner;
public class LowerCase{
public static void main (String[] args) {
String input, output = "", inter;
Scanner scan, lineScan;
scan = new Scanner(System.in); // Scan from the keyboard
System.out.println("Enter a line of text: ");
input = scan.nextLine(); // Scan the line of text
lineScan = new Scanner(input);
while (lineScan.hasNext()) {
inter = scan.next();
output += inter.toLowerCase() + " ";
}
System.out.println(output);
}
}
我不知道我的实施有什么问题!它可以正常编译,但是当我运行代码并键入输入短语时,它会冻结。