Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regrading ArrayList

 
Prahlad Joshi
Ranch Hand
Posts: 44
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the API for the size() method in ArrayList?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic