javamitra, Samastipur
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.
here 10 is the default inital capacity of ArrayList but there is no way to find it..why?
Your program returns 0 because there is no elements in your object al. The size returns the number of elements in the list.
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
import java.util.*;
ReplyDeleteclass 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.
here 10 is the default inital capacity of ArrayList but there is no way to find it..why?
ReplyDeleteYour program returns 0 because there is no elements in your object al. The size returns the number of elements in the list.
ReplyDeleteI have read your blog its very attractive and impressive. I like it your blog.
ReplyDeleteJava 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