我有一个班级作业,我必须制作一个程序来获取现有文件并将所有字母转换为大写。以下是部分代码(特别是循环):
// Read lines from the file until no more are left.
while (inputFile.hasNext())
{
// Read the next name.
String friendName = inputFile.nextLine();
// Need line to make all letters uppercase
}
System.out.print("Enter the saved file name: ");
String filename2 = keyboard.nextLine();
当我现在运行它时:我能够打开第一个文本文件并创建第二个 txt 文件,但新文件中没有字母。