mercredi 17 février 2021

How would you create a list of Objects with randomly generate elements in Java?

I am working on a program for marine vessel operations. To test out some programs I have been trying to generate a list of random ships with different elements like names, serial numbers, a few Booleans and other integers. I have developed a system to randomly generate the data, but I haven't figured out how to bunch it together and store them in a list. The closest I got was storing all the data as a String and creating an array of string. However, this will not work because I want to access ship data based off of other elements.

I need a way to create a list of objects with randomly generated elements so that I can access the individual elements in a single object.




Aucun commentaire:

Enregistrer un commentaire