ArrayList macd = new ArrayList(); //Populate the arrays with associated data while (closeRS.next()){ macd.add(closeRS.getString("macd")); }
I am using the above code to populate a few ArrayLists while collecting data from MySQL. I want to then assign the last ArrayList value to a double variable. I can get the length of the array but when I try putting the value in a double var it say's it's a object. "An object is a dynamically created instance of a class type or a dynamically created array." Is there a way to put a double into the ArrayList in the first place or should I convert it afterwards?
int mdpos = macd.size() - 1; double lastmacd = macd.get(mdpos - 1); //Line contains error