title: how to solve java.lang.ClassCastException error
body: <p>I have designed default table model in JTable properties of swing eclipse. so when i tried to do calculations get error......Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer </p>
  
  <pre><code>public class punchingPBill extends JFrame
  {
      DefaultTableModel model;
      Double rate,discount,amount,exciseduty,outputvat;
  
      {
          String[] columnNames =  {"Sr.No", "Description Of Goods", "quantity", "Rate", "Per", "Discount", "Basic Excise Duty", "Output Vat", "Amount"};
          Object[][] data = { {new Integer(1),"",new Integer(1), new Double(0.0),new Double(0.0),new Double(0.0),new Double(0.0),new Double(0.0),new Double(0.0)}};
  
      model = new DefaultTableModel(data, columnNames);
      }       
          table.setModel(model);
          table.setRowHeight(25);
  
  private void setTableModelListener()
      {
          System.out.println("enter listen");
          TableModelListener tableModelListener = new TableModelListener() 
  {
           public void tableChanged(TableModelEvent e)
              {
                 if (e.getType() == TableModelEvent.UPDATE)
                  {
                      System.out.println("Cell " + e.getFirstRow() + ", "
                              + e.getColumn() + " changed. The new value: "
                              + table.getModel().getValueAt(e.getFirstRow(),
                                      e.getColumn()));
                      int row = e.getFirstRow();
                      int column = e.getColumn();
  
                      if(column == 2||column == 3||column == 5)
                      {
                       Integer    quantity = ((Integer) model.getValueAt(row, 2)).intValue();
                     rate = ((Double) model.getValueAt(row, 3)).doubleValue(); 
                     discount=((Double) model.getValueAt(row, 5)).doubleValue();
                     amount=new Double(rate-(quantity*rate*(discount/100)));
  
                     model.setValueAt(amount, row, 8);
  
                   }
  
                  }
              }
          };
          table.getModel().addTableModelListener(tableModelListener);
  }
  </code></pre>
  
  <p>got errors at- Integer  quantity = ((Integer) model.getValueAt(row, 2)).intValue();.......rate = ((Double) model.getValueAt(row, 3)).doubleValue();......discount=((Double) model.getValueAt(row, 5)).doubleValue();</p>