title: How to initialize variable without value
body: <p>I want to show value inside Textview. But problem is that its showing 0 in my Textview. It is coming from int total=0. I am doing setText but its not giving value I want.</p>
  
  <p>If I remove 0 and keep int total then it's showing variable total is not initialized. If I initialize it then it shows that value in Textview.</p>
  
  <pre><code>public int getTotal(ArrayList&lt;Integer&gt; price){
      int total=0;
      for(int i=0;i&lt;price.size();i++){
          total= total+Integer.parseInt(String.valueOf(price.get(i)));
      }
      return total;
  }
  
  textViewamount=(TextView)findViewById(R.id.amountdisplay);
  textViewamount.setText(" "+getTotal(price));
  </code></pre>