8:07 am - Sunday August 20, 2017

LinkedList Example Program for element()

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

//LinkedList Example Program for element()
/**
* @author   candidjava.com
* @description:Retrieves, but does not remove, the head (first element) of this list.

*/

import java.util.*;

public class List {
public static void main(String args[]) {
LinkedList s = new LinkedList();// creats objects for linkedlist.
s.add(1);// add the elements
s.add(3);
s.add(4);
s.add(6);
System.out.println(s.element());// this method is used for retrieves
// first element of the list.
}
}

Output:
1

BACK

Filed in: Z-A All Java Codes

Comments are closed.