View Single Post
  #2 (permalink)  
Old 03-17-2008, 09:25 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,189
hardwired is on a distinguished road
Code:
List<String> list = new ArrayList<String>(); // Get String at index 2 in list. int index = 2; String s = list.get(index); // get returns an Object — see api. // So if not using generics you will need to cast the // value returned by/from the get method to the // type you put into the list. List list = new ArrayList(); int index = 2; String s = (String)list.get(index);
Reply With Quote