Skip to content

Commit 08e3655

Browse files
committed
Add linkedlist addlast method example
1 parent 8f0441c commit 08e3655

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.gaurav.ExProject.LinkedList;
2+
3+
import java.util.LinkedList;
4+
5+
public class LinkedListAddLast {
6+
7+
public static void main(String[] args) {
8+
9+
LinkedList<String> linkedList = new LinkedList<String>();
10+
linkedList.add("Austin");
11+
linkedList.add("Boston");
12+
linkedList.add("Atlanta");
13+
linkedList.add("Madison");
14+
linkedList.add("Columbia");
15+
16+
System.out.println(linkedList);
17+
18+
// add element at the end
19+
linkedList.addLast("Albany");
20+
System.out.println(linkedList);
21+
22+
}
23+
24+
}

0 commit comments

Comments
 (0)