Hey all!
I have a question regarding how a user can generate a new object.
For example, lets say that I have a GUI application in which the user will be able to put an order. That order has to be created, with a new name and new values. The order itself will be stored in an array or some other type of collection.
My question is how do you put it in code in the most simplest way? The area I'm stuck on is generating new object names, and these must be different (hence different orders).
Here is an example without GUI:
// Using scanner class int a = 0; System.out.println("Hey! Place a new order!"); a = scan.nextInt(); if(a>0){ Order x = new Order(); x.setOrderID(a); CollectionOfOrders.put(x); }
Can you point me towards the right direction: for-loop? It's the names