title: Java - Getting rid of NullPointerException
body: <p>Think about two cases case1 and case2 plus two methods method1 and method2. Say method1 solves case1 and method2 solves case2. Now, I have a program that might end up with case1 or case2. In my codes, I call method1 no matter what case happens. But, if case2 occurs, method1 gives a nullpointerexception.</p>
  
  <p>What I want is the following: my codes should call method1 first, if an exception occurs, then method2 is called. How am I gonna do that? Since I have no info about try and catch, I really need some help!</p>