HI,
Which is the correct way to get the value from a JComboBox as a String and why is it the correct way. Thanks.
String x = JComboBox.getSelectedItem().
String x = JComboBox.getSelectedItem().toString();
will convert any value weather it is Integer, Double, Long, Short into text on the other hand,
String x = String.valueOf(JComboBox.getSelectedItem());
will avoid null values, and convert the selected item from object to string