ok this is my last function in my project
i must build a function that takes as an argument String filename
create an array of string
and read line by line from that file and store each line in that array
all what i tried failed
am in dispersed need for this b4 tomorrow help plz
read from text file in java
read from text file in java
There is an UNEQUAL amount of good and bad in most things, the trick is to work out the ratio and act accordingly. "The Jester"
dude are you for real
i know how to read from file and i know how to fill an array
i created the FileInputStream and DataInputStream even i googe and check it again in case i was mistaken
but every think was clear
i even modified this pasted code
it was giving me a 7 lines error upon running last night
i don't know why the f**k is working today
it's not like i was asking you to do my homework or smthg
i faced a problem, and i asked for help
and btw it's a 35 line function from a 600 line code so.... i know how to fill an array and read from file
i know how to read from file and i know how to fill an array
i created the FileInputStream and DataInputStream even i googe and check it again in case i was mistaken
but every think was clear
i even modified this pasted code
Code: Select all
import java.io.*;
class FileRead
{
public static void main(String args[])
{
try{
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("textfile.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
}
//Close the input stream
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
it was giving me a 7 lines error upon running last night
i don't know why the f**k is working today
it's not like i was asking you to do my homework or smthg
i faced a problem, and i asked for help
and btw it's a 35 line function from a 600 line code so.... i know how to fill an array and read from file
There is an UNEQUAL amount of good and bad in most things, the trick is to work out the ratio and act accordingly. "The Jester"