File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "regrading ArrayList" Watch "regrading ArrayList" New topic

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[])



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

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
I agree. Here's the link:
subject: regrading ArrayList
It's not a secret anymore!