// CS1101 (AY2007/8 Semester 1)
// Lab 9 Task 3 (ungraded)
// DemoLab9.java 
// Aaron Tan
/**
 * This program reads a two-dimensional array of characters from a 
 * text file "demo.dat".
 */

import java.io.*;
import java.util.*;

public class DemoLab9 {

   private String[] matrix;

   public DemoLab9 (String[] m) {
      matrix = m;
   }

   public static void main(String[] args) throws IOException {

      Scanner scanner = new Scanner(new File ("demo.dat"));

      int rows = scanner.nextInt();
      int columns = scanner.nextInt();
      String skip = scanner.nextLine();
      String[] grid = new String[rows];

      for (int r = 0; r < rows; r++) 
         grid[r] = scanner.nextLine();

      DemoLab9 myDemo = new DemoLab9(grid);

      System.out.print(myDemo); 
   }

   // String representation of the Demo object
   public String toString() {
      StringBuffer buf = new StringBuffer();

      for (int r = 0; r < matrix.length; r++) {
         buf.append(matrix[r] + '\n');
      }
      return buf.toString();
   }

}

