title: How to ignore Exceptions in Java
body: <p>I have the following code:</p>
  
  <pre><code>TestClass test=new TestClass();
  test.setSomething1(0);  //could, but probably won't throw Exception
  test.setSomething2(0);  //could, but probably won't throw Exception
  </code></pre>
  
  <p>I would like to execute: <code>test.setSomething2(0);</code> even if <code>test.setSomething(0)</code> (the line above it) throws an exception. Is there a way to do this OTHER than:</p>
  
  <pre><code>try{
     test.setSomething1(0);
  }catch(Exception e){
     //ignore
  }
  try{
     test.setSomething2(0);
  }catch(Exception e){
     //ignore
  }
  </code></pre>
  
  <p>I have a lot of test.setSomething's in a row and all of them could throw Exceptions. If they do, I just want to skip that line and move to the next one.</p>
  
  <p>For clarification, I don't care if it throws an Exception, and I can't edit the source code of the code which throws this exception. </p>
  
  <p>THIS IS A CASE WHERE I DON'T CARE ABOUT THE EXCEPTIONS (please don't use universally quantified statements like "you should never ignore Exceptions"). I am setting the values of some Object. When I present the values to a user, I do null checks anyway, so it doesn't actually matter if any of the lines of code execute.</p>