-
Notifications
You must be signed in to change notification settings - Fork 0
/
List.java
47 lines (47 loc) · 999 Bytes
/
List.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.*;
class Implementlist
{
void implement()
{
LinkedList<String> ll=new LinkedList<String>();
ll.add("Apple");
ll.add("Orange");
ll.add("papaya");
System.out.println("Elements in linkedlist are :" + ll);
}
}
class Implementstack
{
void implement()
{
Stack<Integer> stacks= new Stack<>();
stacks.push(1);
stacks.push(2);
stacks.push(3);
System.out.println("Elements in stack are : " + stacks);
}
}
class Implementdeque
{ void implement()
{
Deque<String> deque = new ArrayDeque<>();
deque.add("Volvo");
deque.add("BMW");
deque.add("Maruthi");
System.out.println("Elements in deque are :");
for (String str : deque) {
System.out.println(str);
}
}
}
public class List
{
public static void main(String[] args) {
Implementlist list = new Implementlist();
Implementstack stk = new Implementstack();
Implementdeque dq = new Implementdeque();
list.implement();
stk.implement();
dq.implement();
}
}