While inserting the selected item from JComboBox it show's an Null Pointer Exception how to fix this?
This is for an java swing Registration form using java eclipse and Mysql
if ( gender.getSelectedIndex()!=-1)
{
//g is ComboBox variable name
String value = g.getSelectedItem().toString();
sta.setString(4, value);
}
i except the selected item from combobox to be stored in mysql