我有一个文件夹,其文件名是:“名称列表”。在那个文件夹里我有一个5个“.txt”文件文件,每个文件文件名都是一个人的名字。在一个目录中输出多个.txt文件中的字符串
我想检索五个文档并在每个文档中显示字符串。我该怎么做呢?我尝试这样做:
import java.io.*;
import java.util.*;
public class Liarliar {
public static void main(String args[])throws IOException{
File Galileo = new File("C:\\List of names\\Galileo.txt");
File Leonardo = new File("C:\\List of names\\Leonardo.txt");
File Rafael = new File("C:\\List of names\\Rafael.txt");
File Donatello = new File("C:\\List of names\\Donatello.txt");
File Michael = new File("C:\\List of names\\Michael.txt");
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
try{
System.out.println("Enter a number list of names:");
Scanner scanner = new Scanner(System.in);
int input = scanner.nextInt();
}catch(FileNotFoundException e){
}catch(IOException e){
}
}
}
预先感谢某人的时间...