[Solved] Declaring objects name using some loop [closed]


Objects don’t have names – variables have names. When you declare a variable and initialize it (Java):

Person alice = new Person("Alice", 25);

then alice is the name of a variable, not the name of an object.

If you need to create objects in a loop and keep track of them, then use an array or a collection class such as ArrayList to keep track of the objects.

solved Declaring objects name using some loop [closed]