Java Deque add() MethodThe add() method of Deque interface is used to insert the specified element into the specified queue represented by the deque and returns true upon success and throws an IllegalStateException if there is no current space available. Specified by:
Syntax:Parameter:The above method consists of only one parameter:
Return:The above method returns a Boolean value, i.e., true. Example 1Test it NowOutput: Week : [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] Example 2Test it NowOutput: The sequence is given as : 2 4 6 8 10 Example 3Output: Enter the name : Tina Shyam Falguni The deque is given as : [Tina, Shyam, Falguni] Next TopicJava Deque |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India