This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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
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
 
GeeCON Prague 2014
 
subject: regrading ArrayList