Java ListIterator add() MethodThe add() method of ListIterator interface is used to insert the given element into the specified list. The element is inserted automatically before the next element may return by next() method. SyntaxParametersThe above method requires only one method:
ReturnNA Throws:UnsupportedOperationalArgument- If the add() method is not supported by the given list iterator. ClassCastException- If the class of some of the element avoids it from being added into the list. IllegalArgumentException- If some of the element avoids it from being added into the list. Example 1Test it NowOutput: Hello Everyone Example 2Test it NowOutput: The list is given as: 66.9 70.4 34.6 Example 3Test it NowOutput: The list of alphabets is given as: [t, h, j, m] Next TopicJava ListIterator |
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