Hello experts :-)
Just started to learn Java from "Sams teach yourself Java 6 in 21 days".
There is an example there:
import org.cadenhead.ecommerce.*;
public class GiftShop {
public static void main(String [] args) {
Storefront store = new Storefront();
store.addItem("C01", "MUG", "9.99", "150");
store.addItem("C02", "LG MUG", "12.99", "82");
store.addItem("C03", "MOUSEPAD", "10.49", "800");
store.addItem("D01", "T SHIRT", "16.99", "90");
store.sort();
for (int i = 0; i < store.getSize(); i++) {
Item show = (Item)store.getItem(i);
System.out.println("\nItem
ID: " + show.getId() +
"\nName: " + show.getName() +
"\nRetail Price: $" + show.getRetail() +
"\nPrice: $" + show.getPrice() +
"\nQuantity: " + show.getQuantity());
}
}
}
To compile it using Eclipse I created project Storefront and a folder structure for a package, please have a look at attached file.
I try to run it as an application and get an error message:
"Could not find the main class. Program will exit."
What do I do wrong?
Thank u :-)
Start Free Trial