View Single Post
  #3 (permalink)  
Old 01-02-2008, 10:50 PM
roots's Avatar
roots roots is offline
Moderator
 
Join Date: Jan 2008
Location: Dallas
Posts: 263
roots is on a distinguished road
Seems like homework for me but dont want to discourage you.

Code:
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class demo { public static void main(String args[]) { String data = null; int recCount = 0; try { FileReader fr = new FileReader("C:\\Development\\demo.txt"); BufferedReader br = new BufferedReader(fr); data = new String(); // For the first line thing data = br.readLine(); if (data != null) { char[] allCharacters = data.toCharArray(); for (int i = 0; i < allCharacters.length; i++) { System.out.println(allCharacters[i]); } } // For other lines while ((data = br.readLine()) != null) { recCount++; // What is this for ?? System.out.println(data); } // This should help you with substring as well System.out.println(data.substring(26, 53)); } catch (IOException e) { System.out.println("IOException error!"); e.printStackTrace(); } } }
Hope it helps
__________________
dont worry newbie, we got you covered.
Reply With Quote