Hi,
If i want to read a Java Application program and save it into my program, is the code below is the right one? I mean, reading lines is the correct approach or is there another way?
try {
FileInputStream f = new FileInputStream("My_File.txt");
BufferedReader input = new BufferedReader(new InputStreamReader(f));
String line;
while ((line = input.readLine()) != null) {
fileCollection.add(line);
}
input.close();
}
catch (IOException e) {
}
Thank you guys
If i want to read a Java Application program and save it into my program, is the code below is the right one? I mean, reading lines is the correct approach or is there another way?
try {
FileInputStream f = new FileInputStream("My_File.txt");
BufferedReader input = new BufferedReader(new InputStreamReader(f));
String line;
while ((line = input.readLine()) != null) {
fileCollection.add(line);
}
input.close();
}
catch (IOException e) {
}
Thank you guys