title: How to check null for getter methods in java
body: <p>I have a POJO class.</p>
  
  <pre><code>class Activity{
     private String name;
  
     public String getName()
        return name;
     }
  
     public void setName(String name){
        this.name=name;
     }
  }
  </code></pre>
  
  <p>im having belw condtions.its not enr=ering properly in those condtions accordingly</p>
  
  <pre><code> if(stlmtTransRequestVO.getStlmtTransId()!=null &amp;&amp; stlmtTransRequestVO.getPaymentTransId()!=null){
  stlmtTransDtlsList = (List&lt;StlmtTransResponseVO&gt;) queryForList(
          "GET_STLMTPAY_TRANSACTIONS", stlmtTransRequestVO);
  
  
   }else if(stlmtTransRequestVO.getAgentId()!=null &amp;&amp; stlmtTransRequestVO.getAgencyId()==null){
  stlmtTransDtlsList = (List&lt;StlmtTransResponseVO&gt;) queryForList(
          "GET_AGENT_TRANSACTIONS", stlmtTransRequestVO);
  
   }else if(stlmtTransRequestVO.getAgencyId()!=null &amp;&amp; stlmtTransRequestVO.getAgentId()==null){
  stlmtTransDtlsList = (List&lt;StlmtTransResponseVO&gt;) queryForList(
          "GET_AGENCY_TRANSACTIONS", stlmtTransRequestVO);
  
   }else if(stlmtTransRequestVO.getAgencyId()!=null &amp;&amp; stlmtTransRequestVO.getAgentId()!=null){
  
  }
  </code></pre>
  
  <p>How to check this getter method for having data or not?</p>
  
  <p>I have tried below scenarios but not working</p>
  
  <pre><code>   1) obj.getName()!=null
     2) obj.getName().isEmpty()
  </code></pre>