java : convert string value to int -


to JTable , I follow the row for [row 1] and calculate the values Do:

  Last Array List & lt; String & gt; Value = new array list & lt; String & gt; (); End end nb = myTable.getRowCount (); Int sum = 0; (Int i = 1; i & lt; nb; i ++) for {string column = value = myTable.getColumnValue (i, columnName); Yoga = Yoga + Integer.parseInt (columnValue); Value list Add (column value); }   

But I found:

  java.lang.NumberFormatException: for input string: "java.lang.NumberFormatException.forInputString (unknown source) Java.lang.Integer.parseInt (unknown source) at Java.lang.Integer.parseInt (unknown source)    

Your table contains at least one empty cell.

Here's a suggestion:

  Try {sum + = integer.parseont (columnValue) );} Hold (Number Format Expection NFE) {// Cell is either empty or not an integer number //   

Note, method getColumnValue (int i, string name) javax.swing. JTable is not defined for . If you use the subclass of JTable , then there may be an error in that class / method: it is a blank in place of the cell value The string can return.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -