
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What does the method removeElementAt(int index) do in java?
The removeElementAt(int index) method is used to delete the component at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously and the size of this vector is decreased by 1.
Example
public class VectorDemo { public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4); vec.add(3); vec.add(2); vec.add(1); System.out.println("Remove element at index 2"); vec.removeElementAt(2); System.out.println("Added numbers are :- "); for (Integer number : vec) { System.out.println("Number = " + number); } } }
Output
Remove element at index 2 Added numbers are :- Number = 4 Number = 3 Number = 1
- Related Questions & Answers
- What does the method elementAt(int index) do in java?
- What does the method fill(int[], int val) do in java?
- What does the method int capacity() do in java?
- What does the method get(int) do in java?
- What does the method remove(int) do in java?
- What does the method removeRange(int fromIndex, int toIndex) do in java?
- What does the method equals(int[] a1, int[] a2) do in java?
- What does the method copyOf(int[] original, int newLength) do in java?
- What does the method fill(int[], int fromIndex, int toIndex, int val) do in java?
- What does the method sort(int[] a, int fromIndex, int toIndex) do in java?
- What does the method copyOfRange(int[] original, int from, int to) do in java?
- What does the method ensureCapacity(int, minCapacity) do in java?
- What does the method hashCode(int[] a) do in java?
- What does the method sort(int[] a) do in java?
- What does the method fill(obj[], int fromIndex, int toIndex, int val) do in java?
Advertisements