上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 34 下一页
摘要: // 读取txt文件 String filePath = "C:\\Users\\lenovo\\Desktop\\哈利波特英文版\\Harry Potter and the Goblet of Fire.txt"; String outputFilePath = "2.txt"; try { // 阅读全文
posted @ 2023-11-13 20:59 new菜鸟 阅读(12) 评论(0) 推荐(0)
摘要: // 创建BufferedReader对象读取文件内容 BufferedReader reader = new BufferedReader(new FileReader(filePath)); String line; Map<String, Integer> wordCountMap = new 阅读全文
posted @ 2023-11-13 20:59 new菜鸟 阅读(25) 评论(0) 推荐(0)
摘要: // 逐行读取文件内容并统计单词出现次数 while ((line = reader.readLine()) != null) { String[] words = line.split("\\s+"); for (String word : words) { if (!word.isEmpty() 阅读全文
posted @ 2023-11-13 20:59 new菜鸟 阅读(20) 评论(0) 推荐(0)
摘要: System.out.print("请输入前N个单词的数量:"); int n = scanner.nextInt(); BufferedWriter writer = new BufferedWriter(new FileWriter(outputFilePath)); for (int i = 阅读全文
posted @ 2023-11-13 20:59 new菜鸟 阅读(12) 评论(0) 推荐(0)
摘要: public class HelloApplication { public static void main(String[] args) { // 读取txt文件 String filePath = "C:\\Users\\lenovo\\Desktop\\哈利波特英文版\\Harry Pott 阅读全文
posted @ 2023-11-13 20:59 new菜鸟 阅读(15) 评论(0) 推荐(0)
摘要: 今天对文件处理与流文件进行了学习 package com.example.demo3;import java.io.*;import java.util.*; public class HelloApplication { public static void main(String[] args) 阅读全文
posted @ 2023-11-13 20:58 new菜鸟 阅读(73) 评论(0) 推荐(0)
摘要: 今天对文件处理与流文件进行了学习 package com.example.demo3;import java.io.*;import java.util.*; public class HelloApplication { public static void main(String[] args) 阅读全文
posted @ 2023-11-13 20:58 new菜鸟 阅读(7) 评论(0) 推荐(0)
摘要: PriorityQueue<Map.Entry<String, Integer>> pq = new PriorityQueue<>((a, b) -> b.getValue().compareTo(a.getValue())); for (Map.Entry<String, Integer> en 阅读全文
posted @ 2023-11-13 20:58 new菜鸟 阅读(20) 评论(0) 推荐(0)
摘要: // 创建BufferedReader对象读取文件内容 BufferedReader reader = new BufferedReader(new FileReader(filePath)); String line; Map<String, Integer> wordCountMap = new 阅读全文
posted @ 2023-11-13 20:58 new菜鸟 阅读(17) 评论(0) 推荐(0)
摘要: 今天对文件处理与流文件进行了学习 package com.example.demo3;import java.io.*;import java.util.*; public class HelloApplication { public static void main(String[] args) 阅读全文
posted @ 2023-11-13 20:57 new菜鸟 阅读(19) 评论(0) 推荐(0)
上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 34 下一页