title: How to generate Fibonacci series in ArrayList
body: <p>Currently I am working on a task, where I should prompt the user to input a number from the console (e.g. 1) and then:</p>
  
  <ul>
  <li>First two elements of ArrayList are the input number(1);</li>
  <li>Every next element at the ArrayList is equal to sum of previous two;</li>
  <li>Print the ArrayList.</li>
  </ul>
  
  <p>Here is my trainee code:) :</p>
  
  <pre><code>public class ex3 {
  public static void main(String[] args) {
  
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter a number :");
      int number = sc.nextInt();
  
      List&lt;Integer&gt;numbersList = new ArrayList&lt;&gt;();
      numbersList.add(number);
      numbersList.add(number);
  
      int k = 0,a = number,b = number;
      for(k=0;k&lt;=10;k++) {
          k = a + b;
          System.out.println(k + " ");
          a=b;
          b=k;
      }
    }
  }
  </code></pre>
  
  <p>I see that obviously I have not put the fibonacci series into the ArrayList.</p>