title: Adding Number in a list using java
body: <p>I have written the following code to add the elements of the java. but i am unable to continue from one part here.</p>
  
  <pre><code>enter code here
  import java.io.*;
  import java.util.*;
  class adder
  { 
  public static void main(String[] args)
  {
   List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
   int b;
   System.out.println("Enter the number");
   InputStreamReader inp = new InputStreamReader(System.in);
   BufferedReader bnp = new BufferedReader(inp);
   list.add(Integer.parseInt(bnp.readLine()));
    for(int i=0;i&lt;list.size();i++)
    {
    b += list[i];
    }
     System.out.println("The answer is" + b);
   }
    }
  
   **OUTPUT**.
    add.java:15: array required, but java.util.ArrayList&lt;java.lang.Integer&gt; found
    b += list[i];
  </code></pre>