8:23 pm - Wednesday October 18, 2017

LinkedList Example Program for removeLast()

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 removeLast()
/**
* @author   candidjava.com
* @description: //Removes and returns the last element from this list.
*/
import java.util.LinkedList;

public class List1 {
public static void main(String args[]) {
LinkedList l = new LinkedList();// create object for linkedlist.
l.add("e");
l.add("f");
l.add("d");// add elements in list.
l.add("s");
l.add("a");
l.add("d");
System.out.println(l.removeLast());// removes last element of the list
// and returns the removed element.
}
}

Output:
d

BACK

Filed in: Z-A All Java Codes

Comments are closed.