Zeichenfolge in der Warteschlange
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Queue<String> queue = new LinkedList<>();
System.out.println("Enter input:");
String input = "";
try (Scanner scan = new Scanner(System.in)) {
while (scan.hasNextLine()
&& (input = scan.nextLine()).length() != 0) {
queue.add(input);
}
}
System.out.printf("Queue: %s%n", queue);
}
}
Fo Angel