hey there! how do i read each line in a .dat file? is it the same way as reading a .txt file?
As long as the information in the file is just plain text, it doesn't matter what the extension of the file is... Code: import java.io.*; public class Test { public static void main(String args[]) { try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("c:\\status.txt"))); String s = ""; while ((s=br.readLine())!=null) { System.out.println(s); } } catch (Exception e){} } }
import java.io.*; public class Test { public static void main(String args[]) { try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("c:\\status.txt"))); String s = ""; while ((s=br.readLine())!=null) { System.out.println(s); } } catch (Exception e){} } }
Laugh, and the world laughs with you. Cry, and you just water down your vodka. Take credit, not responsibility
Forum Rules