Cannot switch on a value of type Object. Only convertible int values, strings or enum variables are permitted
I'm trying to hide and option using switch statement but this is the error i receive.
could someone help me fix this please?
public void actionPerformed(ActionEvent e) { if(e.getSource() == comboDest1) { switch(comboDest1.getSelectedItem()) { case "Crete": //throw away the old accomodation array, and assign a new array to it with specific accomodations Accomodation = new String[]{"Select your Accomodation","Hotel", "Villa", "Bed & Breakfast"}; //throw away the old combobox and make a new one with the new accomodation array comboAccom1 = new JComboBox(Accomodation); break; } } } }