It is possible to iterate through the elements of a array in a loop Java without explicitly specifying the number of elements in the array?
Yes, simply by using a for-each loop:
Object  myArray = ....; // Whatever
for (Object obj : myArray)
However, you would have had to set the array size before using it. If you really want a collection with a variable size look at java.util.ArrayList
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.