import java.util.Scanner;

/*********************************************************************
*
* @author Duncan Buell
*/
public class Sub2
{

  public Sub2()
  {
  } // public Sub2()

//
// In this program we are going to read in all the data as string
// data.  This makes irrelevant all the error issues about expecting
// an int and getting a double, for example.
//
// Please note one of the main subtle messages of this code segment.
// The penalty for the equivalent of a fencepost error in reading data
// is either that you don't read the last line or last entry (that is,
// that you go one iteration of the read too few), or else that you try
// to read data after having read all the data, and thus read one too
// many times and cause a run-time error.
//
// This loop avoids those errors by testing at the top of the loop in the
// 'while' whether data of any sort exists (you can always read strings)
// and continuing into the loop only if data exists.
//
  public void doSub2(Scanner dataFile)
  {
    String inString = null;

    while(true == dataFile.hasNext())
    {
      inString = dataFile.next();
      System.out.println("string is " + inString);
    }
  } // public void doSub2(Scanner dataFile)

} // public class Sub2

