title: 'Null pointer access' when using java output parameters
body: <p>I am working in java and wanting to use something like output parameters. Here is an example:</p>
  
  <pre><code>ClassA objA = null;  
  if(myMethod(objA))  
  {  
     // position (1)
     //use objA somehow  
  } 
  </code></pre>
  
  <p>======================</p>
  
  <pre><code>public bool myMethod(ClassA obj)   
  {   
       obj = .....   
  }  
  </code></pre>
  
  <p>I am using Eclipse and the problem I'm having is that eclipse shows the warning:<br>
   <code>Null pointer access. The variable objA can only be null at this location</code> when i reach position (1)</p>
  
  <p>Since there is no concept of <code>out</code> parameters in java i'm a little stumpped    </p>
  
  <p>==================================================================<br>
  EDIT: I have gotten several people mention to change the method to return my object instead of bool. But what If i need a method to alter several objects? 
  ex:</p>
  
  <pre><code> ClassA objA = null;  
    ClassB objB = null;
      if(myMethod(objA, objB))  
      {  
         // position (1)
         //use objA and objB somehow  
      } 
  </code></pre>
  
  <p>======================</p>
  
  <pre><code>public bool myMethod(ClassA obj, ClassB obj2)   
  {   
       //do stuff 
  }  
  </code></pre>
  
  <p>How can I do this? I dont want to make a custom class for every flavor of return objects possible?  </p>
  
  <p>thanks,<br>
  Stephanie</p>