title: Use a stack to check .txt file for ('s, {'s, ['s, etc - Java
body: <p>I am trying to write a method in java to search a text file that I imported for specific characters. The file is actually a java program that I designed and converted to a <code>.txt</code> file.</p>
  
  <p>When an opening brace/bracket is found, I am supposed to add (push) it to a stack and then when a corresponding closing brace/bracket is found I am supposed to remove (pop) it from the stack.</p>
  
  <p>The purpose is to see if I have the correct amount of <code>)</code>, <code>}</code>, <code>]</code> and <code>&gt;</code> to correspond with the <code>(</code>, <code>{</code>, <code>[</code> and <code>&gt;</code>. If they all match up the method should return true, if they don't it should return false.</p>
  
  <p>Anyone know how I can write this?</p>