Java Vector removeElement() MethodThe removeElement() method of Java Vector class is used to remove the first (lowest-indexed) occurrence of the argument from this vector. Removing an element decreases the vector size by one. SyntaxFollowing is the declaration of removeElement() method: Parameter
ReturnThe removeElement() method returns true if the argument was a component of the vector, otherwise returns false. ExceptionsNA Compatibility VersionJava 1.2 and above Example 1Test it NowOutput: Vector element before removal: [1, 2, 3, 4, 5, 6] Vector element after removal: [1, 2, 3, 4, 6] Example 2Test it NowOutput: The elements of a Vector before remove: [Rahul, Karan, Rahul, Rohan] Is the removal successful?? true The elements of the Vector after remove: [Karan, Rahul, Rohan] Next TopicJava Vector |
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