Java basics
addLast()
The java.util.LinkedList.addFirst(E e) method inserts the specified element at the end of this list.
Syntax:public void addLast(E e)
Example:import java.util.*;
public class LinkedListDemo {
public static void main(String[] args) {
// create a LinkedList
LinkedList list = new LinkedList();
// add some elements
list.add("Hello");
list.add(2);
list.add("Chocolate");
list.add("10");
// print the list
System.out.println("LinkedList:" + list);
// add a new element at the end of the list
list.addLast("Element");
// print the new list
System.out.println("LinkedList:" + list);
}
}
Content
License.
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 514 / 159177018. Delta: 0.00232 с