Hello, have a good day everyone. I am confused if what elements are to be inserted in a queue. Are only numbers can be inserted in a queue? Are letters or word(e.g."Subject") can be inserted in a queue? Thank you ahead everyone. Have a nice day.

Any Object can be inserted into a queue. Think about it logically - a queue is just a collection of items where the first thing put in the queue will be the first thing to come out of the queue. A line at a grocery store is an example of a queue. The first person to get in line is the first person to get out of the line.

Yes, i also knew about the concept FIFO, which is opposite from the stack, LIFO. So in this case, words can be inserted in a queue. Ok, thanks for the reply. Thank you very much.:icon_lol:

Hello, have a good day everyone. I am confused if what elements are to be inserted in a queue. Are only numbers can be inserted in a queue? Are letters or word(e.g."Subject") can be inserted in a queue? Thank you ahead everyone. Have a nice day.

Learning by doing is the best form of learning; a small code snippet, a simple web search or the description from the Javadocs would have answered your question. Even though it takes a bit of time, you gain a lot more knowledge than reading ready baked answers. :-)

This question has already been answered. Start a new discussion instead.