View Single Post
  #1 (permalink)  
Old 11-22-2008, 04:20 AM
grahamb314 grahamb314 is offline
Member
 
Join Date: Nov 2008
Posts: 8
Rep Power: 0
grahamb314 is on a distinguished road
Default [SOLVED] ArrayList element to int
Hi all,

I am trying to get a certain element of my ArrayList to an int:
Code:
ArrayList cities = new ArrayList<Integer>();
while (cities.size() != 0) { //while not null (ATM it will always be null till finished writing the loop)
        int s = 0;
        int one = cities.get(d);  //this is where I get the error
        cities.add(s,"x");
        System.out.println("___________");
        System.out.println(cities.get(s));
    }
I get an error: Found Object, required int
(Please note that there may be problems with my loops (its not finished yet) All i need to know is how to get the element d or even element 0 or 1 to save as type int in variable "one"

Any thoughts?

Thanks!
Reply With Quote