Store employee data that obtains from user and the input process stops when the user says no longer wants to enter any data
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
LinkedList<String> employeeData = new LinkedList<>();
System.out.println("Enter employee data (empty line to exit): ");
while (true) {
String data = in.nextLine();
if (data.length() == 0) {
break;
}
employeeData.add(data);
}
}
}
Comments
Leave a comment