title: How do I catch a NoSuchElementException?
body: <p>I am making a function that returns a Boolean type of whether a String has enough tokens. I do this by using this code:</p>
  
  <pre><code>public boolean isEnoughTokens(int tokens, String problem) {
          try {
              StringTokenizer token = new StringTokenizer(problem);
              return true;
          } catch (NoSuchElementException ) {
  
          }
      }
  </code></pre>
  
  <p>The problem is that I haven't figured out how to catch a No such element exception. I think it's super simple but still didn't figure out how to do it.</p>
  
  <p>Thanks, any help will be appreciated!!!</p>