I guess that what you want is retrieve multiple records from the database, and store the results in an array.
An array is not the best suited collection to do this, because arrays in
Java have a fixed size, which is set at the moment you create an array, and here you don't know in advance how many records you are going to retrieve from the database.
So instead of an array, it would be better to use a collection class such as ArrayList, which can grow dynamically. To put the results of the query in an ArrayList of User objects, you could do something like this:
You can learn more about collection classes such as ArrayList in the
Collections Tutorial.