Java Vector removeAllElements() MethodThe removeAllElements() method of Java Vector class is used to remove all elements from the vector and set the size of the vector to zero. SyntaxFollowing is the declaration of removeAllElements() method: ParameterThis method does not accept any parameter. ReturnThis method has return type void so, it does not return anything. ExceptionsNA Compatibility VersionJava 1.2 and above Example 1Test it NowOutput: Size of Vector before removeAllElements() method: 3 Size of Vector after removeAllElements() method: 0 Example 2Test it NowOutput: Elements of Vector is: [3, 5, 2, 4, 1] Elements of Vector after removeAllElements(): [] Size of Vector after removeAllElements() method: 0 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