Answer to Question #288859 in Java | JSP | JSF for mimi

Question #288859

Store employee data that obtains from user and the input process stops when the user says no longer wants to enter any data


1
Expert's answer
2022-01-19T16:30:43-0500
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);
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog