#Need help in ArrayList
1 messages · Page 1 of 1 (latest)
import java.util.List;
import java.util.Scanner;
public class Main {
private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int input = 1;
String strInput;
List<String> list = new ArrayList<>();
while (input != 0) {
System.out.println("enter 0 tho shutdown \nenter 1 to add items \nenter 2 to remove items");
input = scanner.nextInt();
if (input == 1) {
System.out.println("enter the item you want to add in the list");
String[] items = scanner.nextLine().split(",");
list.addAll(List.of(items));
System.out.println(list);
} else if (input == 2) {
System.out.println("enter the item you want to remove it from the list");
}
}
}
} // public class```