Tuesday, February 8, 2011

Default size:

Vector - 10 Arraylist - 10 Hashtable - 11 Hashmap - 16 Hashset - 16
send me response about
what is the default size of StringBuffer


  1. import java.util.*;
    class ArryLst{
    public static void main(String ...args){
    ArrayList al=new ArrayList();
    System.out.println("size= "+ al.size());
    Output: this gives size=0.
    here size() returns the number of element in the list.


    StringBuffer default size is 16.

  2. here 10 is the default inital capacity of ArrayList but there is no way to find it..why?

  3. Your program returns 0 because there is no elements in your object al. The size returns the number of elements in the list.

  4. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai | Java Training Institutes

    Online Java Training Java Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai