Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

String in Queue

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);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java accessing static variables from event handler 
Java :: java fill two dimensional array stream 
Java :: void add method using collections 
Java :: store files system in tree java 
Java :: java ultimo dia del mes 
Java :: hadoop fs get size of directory java 
Java :: boxing and unboxing in java pdf 
Java :: converting amount into millions nad billions Java 
Java :: Kotlin is like java 
Java :: reference value in array list java syntax 
Java :: java writing an object 
Java :: java gui refresh frame 
Java :: entry constructor java 
Java :: what does the continue keyword do in java 
Java :: how to get listview data, TextView 
Java :: txt not chnage on fragment 
Java :: how to make 2 nested loops to count to 100 
Java :: console.log in spring boot 
Java :: stacks based on a linked list 
Java :: android studio setMargin 
Java :: itext new page 
Java :: Add items to ArrayList Using add() function 
Java :: java spigot string to kyori textcomponent 
Java :: are classes in java public by default 
Java :: java unshift 
Java :: how to explicitly declare an array java 
Java :: random number in java between 10 and 20 
Java :: serilize filke in java 
Java :: java how to make a 2d eclipse 
Java :: Append Line Separator In StringBuilder 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =