Can We Store Different Data Types in Stack?
In a Stack, You Can Store Elements of the Same Type or Different Types. Can We Store Different Data Types in Linked List? Yes, Sure According to Heading of...
In a stack, you can store elements of the same type or different types.
Can we store different data types in linked list?
Yes,Sure according to heading of question,the answer is very simple and easy. You can insert any data type values in the linked list I've designed and its very simple to do so.
Can we store different data types in queue?
So the following works fine: Queue<Object> queue = new LinkedList<Object> (); queue. add("string0"); queue. ... Otherwise create a immutable class to encapsulate the different type your Queue can accept, a different constructor for each type it should accept.