Use an enum constructor.
enum Apple { A(10), B(9), C, D(15), E(8); private int price; // price of each apple // Constructor Apple(int p) { price = p; } // Overloaded constructor Apple() { price = -1; } int getPrice() { return price; } }