3:11 pm - Sunday November 23, 2747

Get size of LinkedList using int size()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

            This tutorial explains how  to Get size of LinkedList using  int size() method.

The number of elements in this collection.index value start from 1.

Example

import java.util.LinkedList;
public class ElementSize
{
public static void main(String a[])
{
   LinkedList<String> ll = new LinkedList<String>();
   ll.add ("Orange");
   ll.add ("Apple");
   ll.add ("Grape");
   ll.add ("Banana");
   ll.add ("karthik");
   System.out.println ("The size of linkedList  :"+ll.size());
 }
}

Output

           The size of linked List  :5

BACK

Filed in: Java Examples

Comments are closed.