-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.java
More file actions
36 lines (34 loc) · 1.11 KB
/
Copy pathDriver.java
File metadata and controls
36 lines (34 loc) · 1.11 KB
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
import java.util.*;
public class Driver
{
public static void main(String []args){
ArrayList<Integer> ob=new ArrayList<Integer>();
for(Integer i=0;i<ob.buffer;i++)
{
ob.add(i);
}
System.out.println("Enter Your Choice:");
System.out.println("1. Add Element At Position:");
System.out.println("2. For Printing Elemnts:");
System.out.println("3. For Search when Given Element:");
System.out.println("4. Enter Search when Given Position:");
Scanner sc=new Scanner(System.in);
Integer a=sc.nextInt();
switch(a)
{
case 1: ob.add(20);
ob.Traverse();
break;
case 2: ob.Traverse();
break;
case 3: System.out.println(ob.Search(3));
ob.Traverse();
break;
case 4: System.out.println(ob.getElementAt(3));
ob.Traverse();
break;
case 5: if(ob.isempty())
System.out.println("Arraylist is empty");
}
}
}