title: Type Mismatch when I try to save the database values in an ArrayList. How to avoid it?
body: <p>I try to get all the "RegalID" from my Database and save it in an ArrayList, but I get the type mismatch from int and int []. I really don't know how to avoid this mismatch because the variable in my database has the value int and I need to save it in an array, which can hold an unknown number. So the ArrayList should be the way to go, but how can I avoid this mismatch?</p>
  
  <p>"Type mismatch: cannot convert from ArrayList to int"</p>
  
  <pre><code>public ArrayList&lt;int[]&gt; getAlleRegalID() {
          ArrayList &lt;int[]&gt; regalIdListe = new ArrayList &lt;int[]&gt;(); 
          int regalid =0;
          try {
              String query = "select Regal_ID from regalfach";
              rs= st.executeQuery(query);
              while (rs.next()) {
                  regalid = rs.getInt("Regal_ID");   -&gt; Type mismatch
  
                  regalIdListe.add(regalid);
              }
  
          }
          catch(Exception e) {
              System.out.println(e);
          }
          return regalIdListe;
      }
  </code></pre>