public class TestLine { static int lineNumber = 0; public static void main(String[] args) { try { BufferedReader reader = new BufferedReader(new FileReader("test.txt")); while(reader.ready()) { lineNumber = lineNumber + 1; String line = reader.readLine(); int columnNumber = line.length(); System.out.println("This is line " + lineNumber + " , " + columnNumber + " columns."); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }