Related Examples
 

Java LinkedList removeLast Example

LinkedList class removeLast method example. This example shows you how to use removeLast method.


LinkedList class removeLast method example.public LinkedList removeLast() Removes and returns the last element from this list.

Here is the code

/**
 * @ # RemoveLast.java
 * A class repersenting use to removeLast method of LinkedList class in java.util package
 * version 15 May 2008
 * author Rose India 
 */
import java.util.*;

public class RemoveLast {

    public static void main(String args[]) {
        LinkedList list = new LinkedList();
        int i = 11;
        String str = "Rose";

        //Add the specified element to the end of this list.
        list.add(i);
        list.add(str);
        list.add("India");

        //Remove Last element
        System.out.println(list.removeLast());
        System.out.println("list = " + list);
    }
}

output

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US