title: How to add a value to an array list using Scanner class
body: <p>I want to ask how can I add a value to the arraylist using Scanner class without declaring any variable.</p>
  <pre><code>List&lt;Integer&gt; cl = new ArrayList&lt;&gt;(); 
  List&lt;String&gt; al = new ArrayList&lt;&gt;(); 
      
  System.out.println(&quot;Enter the name of the account user&quot;);
  String name = si.next();
  System.out.println(&quot;Enter the amount you want to deposit in your account&quot;);
  int amount= si.nextInt();
  cl.add(amount);
  al.add(name);
  </code></pre>
  <p>Like in this code I want to add values to the array list without using the variables name and amount.</p>