I am trying to convert an object (selected item on jList1) to a string but it is returning null.
I have tried:
Object object1 = jList1.getSelectedValue();
String string1 = object.toString();
&
String string1 = jList1.getSelectedValue().toString();
But they are both returning null for me, is there something I am doing wrong?
This is what happens when button1 is pressed:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Object object1 = jList1.getSelectedValue();
String string1 = object1.toString();
System.out.println(string1)
}
String string1 = jList1.getSelectedValue().JListare unclear about how the return value is handled.