list - Java containers- adding objects more efficiently and how to return using Identifier -


The code is finally attached.

So this is my first attempt in the Java normal box. I need to collect the object in the class product. Java which is a random class I have several other classes that extend to the product category. I've added them to a container in a product that uses an orllist, but I suspect that besides its efficient addition, I do not know how to call cheese examples. Is there any way that I can specify an identifier for all instances?

Import java.util. *; Public class generic order {public static zero main (string [] args) {ArrayList & lt; Products & gt; Product = new arreelist & lt; Products & gt; (); Product.add (new fruit (123)); Product.add (new computerpart (65)); Product.add (new cheese (123)); Product.add (new service (65)); Product.add (new perimeter (123)); Println (product); }}


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -