You need to keep handle of the objects with you (You can access all of them by references). One of the ways to do it:
ArrayList<Escola> escolaArray = new ArrayList<Escola>();
while(tillTrue) {
escolaArray.add(new Escola(loopNome, loopQtdProfessor);
}
You would need to adjust your code accordingly. You can access all the objects created in
escolaArray
. Also, make sure to keep
escolaArray
in the right scope based on how/where you want to make use of it (inside while loop or outside).