title: How can I turn a String value into a variable name (java)?
body: <p>I am trying to find a way to convert a String value into a variable. Is this possible?</p>
  
  <p>For example:</p>
  
  <pre><code>String str = "chicken";
  /*Then have it so I can do this*/
  int chicken = 2;
  </code></pre>
  
  <p>I know I can just type the variable name in, but I want it so a user input, which is a String,  can be converted into a variable name after a button is clicked.
  Here is what I mean:</p>
  
  <pre><code>/*This is in JavaFX*/
  Button button = new Button("Click Me");
  TextField userText = new TextField();
  ArrayList&lt;List&gt; randomList = new ArrayList&lt;&gt;();
  
  /*When button is clicked*/
  button.setOnAction(e -&gt; {
      ArrayList&lt;List&gt; "The user's text" = new ArrayList&lt;&gt;();
      randomList.add("The user's text");
  });
  </code></pre>
  
  <p>"The user's text" is the user input being used as a variable name.</p>
  
  <p>P.S. = Please don't recommend HashMaps or Maps unless there is no other way. I've already started with ArrayLists.</p>