相关疑难解决方法(0)

同时读取两个文本文件-java

我有两种不同语言的文本文件,它们是逐行对齐的.即textfile1中的第一行应该等于textfile2中的第一行,依此类推.

有没有办法同时逐行读取这两个文件?

下面是文件应该如何显示的示例,假设每个文件的行数大约为1,000,000.

textfile1:

This is a the first line in English
This is a the 2nd line in English
This is a the third line in English
Run Code Online (Sandbox Code Playgroud)

textfile2:

C'est la première ligne en Français
C'est la deuxième ligne en Français
C'est la troisième ligne en Français
Run Code Online (Sandbox Code Playgroud)

期望的输出

This is a the first line in English\tC'est la première ligne en Français
This is a the 2nd line in English\tC'est la deuxième ligne en Français
This is a the third line …
Run Code Online (Sandbox Code Playgroud)

java io text-files readfile

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

io ×1

java ×1

readfile ×1

text-files ×1