1. 在 StringOperation 类的 capitalCharStringArray 方法中,定义了一个 tempString 数组,但实际应该为 temString。
  2. 在 bubbleSort 方法中,第一个 for 循环中的 i 没有初始化,应该改为 int i = 0。
  3. 在 Test2 类中,FileOperation 方法的调用应该为 FileOperation.writeToFile(output,stringWriteToFile),而不是 sch.exe.chapter10_NumOfName.FileOperation(output,stringWriteToFile)。
  4. 在 Test2 类中,创建 Name 对象数组时,应该为 new Name(),而不是 new Names()。
  5. 在 Test2 类中,数组 names 的长度应该为 stringWriteToFile 中不同的大写单词的个数,而不是 stringWriteToFile 的长度。因此,在创建 Name 对象数组时,应该改为 Name[] names = new Name[stringWriteToFile.length / 2]。
  6. 在 Test2 类中,bubbleSort 方法返回值应该为排序后的数组,因此在调用时应该改为 names = sch.exe.chapter10_NumOfName.StringOperation.bubbleSort(names)。
  7. 在 Test2 类中,bubbleSort 方法中的第二个 for 循环中,i++ 应该改为 j++。
  8. 在 StringOperation 类中,eraseMeaninglessWord 方法中的一些替换操作没有意义,例如 s = s.replace("", " "),应该删除这些操作。
  9. 在 readFromFile 方法中,input.hasNextLine() 应该改为 input.nextLine()。同时,在 readFromFile 方法中,应该将每一行的内容用换行符分隔开,即 result = result + input.nextLine() + "\n"
package schexechapter10_NumOfName;许家玮 1925123026 软件工程三班public class StringOperation public static String splitString s String afterOperation = eraseMeaninglessWords; return afterOpe

原文地址: https://www.cveoy.top/t/topic/hacW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录