Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regrading ArrayList

 
Prahlad Joshi
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/*
* 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
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the API for the size() method in ArrayList?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic