Error : java.util.ArrayList cannot be cast to java.lang.String : <p>when am running my action i faced Error : 
" java.util.ArrayList cannot be cast to java.lang.String "</p>

<p>and this is my code :</p>

<pre><code> textField_1 = new JTextField();
       textField_1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
           Object selected = list_1.getSelectedValue();
            Connection conn = null;
            PreparedStatement stmt = null;
            String a =null;
         try{

   conn=DriverManager.getConnection("jdbc:mysql://localhost/flyer","root","000");
   String query= " INSERT INTO flyer_item (discount)  SELECT price * ? FROM `item` WHERE item_name = `?` ";
   Statement st= conn.createStatement();

   java.sql.PreparedStatement ps = conn.prepareStatement(query);
                        ps.setString(1,a);
                        ps.setString(2,(String) selected);
                        ps.executeUpdate();
                        st.executeUpdate(query);


                    } catch (SQLException se){
                        System.out.println(se.getMessage());

                    } }} );
</code></pre>

<p>Any help please ?</p>
