Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are having only four lines that deals with your <code>CallManager</code> class:</p> <pre><code>CallManager clm = new CallManager(); clm.setOperatorName("Banglalink"); System.out.println(clm.internalPreString); System.out.println(clm.preString); </code></pre> <p>The reason why you are getting null :</p> <ol> <li>You are using a default constructor right and there processing is done in it. So this is not a problem</li> <li><p>Now on next line you call <code>setOperator</code> method which has this code:</p> <pre><code>public void setOperatorName( String getMeFromPreferences) { operatorName = getMeFromPreferences; System.out.println("I got it " + operatorName); } </code></pre> <p>Now here you are only setting thw variable <code>operatorName</code> and nothing else. So all other variables are null as you not doing any processing or something that will initialize them to something.</p></li> <li><p>So when you print <code>clm.internalPreString</code> and <code>clm.preString</code> you get null as they are not initialized. But try printing <code>clm.operatorName</code> and it will print the operator name that you passed and was initialzed inside your method <code>setOperatorName</code>.</p></li> </ol> <p>So as you have defined so many method inside your class, use them so that all the variables are set as per your logic</p> <p><strong>UPDATE</strong></p> <pre><code>public void setOperatorName( String getMeFromPreferences) { operatorName = getMeFromPreferences; //call any methods for example and use the values returned from the method by storing it inside a variable String mystring = getOperatorBasedPreString(String operatorName) } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload