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.

Recommended Answers

All 3 Replies

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. :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.