Hi all,
I have a file, let's call it "log.txt" with this format:
Source Destination Distance
1 2 2
1 4 5
2 4 1
and so on...
Questions are:
1. What is the Java syntax to open a file?
2. How does Java read the content of a file line by line?
3. For each line, how do I seperate these numbers and put it under variable names? For instance, reading line 1:
Source[0] = 1, Dest[0]=2, Dist[0] =2 and so on...
Thanks a lot advance.
-Cait
I have a file, let's call it "log.txt" with this format:
Source Destination Distance
1 2 2
1 4 5
2 4 1
and so on...
Questions are:
1. What is the Java syntax to open a file?
2. How does Java read the content of a file line by line?
3. For each line, how do I seperate these numbers and put it under variable names? For instance, reading line 1:
Source[0] = 1, Dest[0]=2, Dist[0] =2 and so on...
Thanks a lot advance.
-Cait