permaculture playing cards*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes regrading ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "regrading ArrayList" Watch "regrading ArrayList" New topic
Author

regrading ArrayList

Prahlad Joshi
Ranch Hand

Joined: Apr 21, 2007
Posts: 44
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package newpackage;

/**
*
* @author Administrator
*/
import java.util.ArrayList;
public class Exp {
static ArrayList<String> asd=new ArrayList<String>(10);;
public static void main(String args[])
{

System.out.println(asd.size());

}

}
o/p is 0 not 10.
i can't understand why this is so.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Did you check the API for the size() method in ArrayList?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regrading ArrayList