title: How do I change the delimiter from a text file?
body: <p>Let's say I got a <em>textfile.txt</em> that I want to read from. This is the text in the file:</p>
  
  <pre><code>23:years:old
  15:years:young
  </code></pre>
  
  <p>Using the <code>useDelimiter</code> method, how can I tell my program that <code>:</code> and newlines are delimiters? Putting the text in one line and using <code>useDelimter(":");</code> works. The problem is when I got several lines of text.</p>
  
  <pre><code>Scanner input = new Scanner(new File("textfile.txt));
  input.useDelimiter(:);
  
  while(data.hasNextLine()) {
   int age = input.nextInt();
   String something = input.next();
   String somethingelse = input.next();
  }
  </code></pre>
  
  <p>Using this code I will get an inputMisMatch error.</p>