Java的一个题目,高手帮忙看看!

来源:百度知道 编辑:UC知道 时间:2024/05/14 21:06:30
实现两个有序数组的合并
1.数组存放在文件a.txt,b.txt中,合并后的数组放入新的文件c.txt中
2.数字以","分割

这学期Java没念好,作业不会做了,呵呵!高手帮忙看看!先谢谢了

现在的学生太懒了。

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;

public class Test {
public static FileInputStream aText;
public static FileInputStream bText;

public static void main(String args[]){

BufferedReader bufA,bufB;
InputStreamReader inputStreamA,inputStreamB;
FileWriter cText = null;

try {
aText = new FileInputStream("a.txt");
bText = new FileInputStream("b.txt");
cText = new FileWriter("c.txt");
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}

try {
inputStreamA = new InputStreamReader(aText);
bufA = new BufferedReader(inputStr