public class Shop { public static void main(String a[]) { // create an array of products (the same number as command line arguments) Product p[] = new Product[a.length]; int i; // initialise p[]: each product is named after the String from the command line for (i = 0; i < a.length; i++) { p[i] = new Product(a[i], 1.0, 123, "arguments"); } // just to check: print out all the names of p[] for (i = 0; i < a.length; i++) { System.out.println(p[i].getName()); } // I'd like to buy 100 items for each product that contains the word "can" in it's name! .... .... .... // example String a = "Coca Cola can"; if (a.indexOf("can") != -1) { // ok, found it } } }