title: Does try catch clause affect performance if used in looping in Java?
body: <p>I want to know if I use one or two try catch in a while loop, does this affect the performance or not?</p>
  
  <p>Example code below:</p>
  
  <pre><code>try {
      // some code
      ....
  
      try {
          // some code
          ...
      } catch(Exception e) {
          if(e is not catchable) {
              //throw it as MyException(e);
          }
      }
  
      // some code
      ...
  
  } catch(Exception e) {
      if(e is my Exception) {
          then do somthing
          ...
      } else { // is other Exception
          if(e is not catchable) {
              then stop the loop
          }
          // else catch it and continue
      }
  }
  </code></pre>
  
  <p>What about <code>if else</code> if used instead, then which one will be the good idea?</p>
  
  <p>If someone knows pleas tell me does it affect performance or not, if yes then why.</p>
  
  <p>My question maybe asked by someone else before, but I also want to know about <code>if-else</code> if it is better then <code>try-catch</code>.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I know if throws <code>Exception</code> then for catching it needs some time, but how about if the program goes whit no Exception jut like:</p>
  
  <pre><code>// some code
          ....
  // some code
          ....
  // some code
          ....
  </code></pre>
  
  <p>Thanks!</p>