Professional Documents
Culture Documents
Experiment 2.3
Student Name: Kaustabh Pal UID: 21BCS8791
Branch: CSE Section/Group: SC-905(B)
Semester: 6th Date of Performance: 29-02-24
Subject Name: JAVA LAB Subject Code: 21CSH-319
1. Aim: Write a Program to perform the basic operations like insert, delete,
display and search in list. List contains String object items where these
operations are to be performed.
3. Input/Apparatus:
Hardware Requirements:- Minimum 384MB RAM, 100 GB hard disk,
processor with 2.1 MHz
4. Procedure:
import java.util.*;
while (true) {
System.out.println("Choose an operation:");
System.out.println("5. Exit");
scanner.nextLine();
switch (choice) {
case 1:
stringList.add(insertString);
break;
case 2:
scanner.nextLine();
} else {
System.out.println("Invalid index.");
break;
case 3:
if (stringList.isEmpty()) {
System.out.println("List is empty.");
} else {
System.out.println("All elements in the list:");
System.out.println(str);
break;
case 4:
if (stringList.contains(searchString)) {
} else {
break;
case 5:
System.out.println("Exiting...");
scanner.close();
System.exit(0);
default:
}
5. Output: