import java.util.Vector; public class Example { public static void main(String[] args) { // Create a new vector VectormyVector = new Vector (); // Add elements to the vector myVector.add("apple"); myVector.add("banana"); myVector.add("orange"); // Access elements by index String firstElement = myVector.get(0); System.out.println(firstElement); // Remove elements from the vector myVector.remove(1); System.out.println(myVector); } }
import array # Create an integer array myArray = array.array('i', [1, 2, 3]) # Access elements by index firstElement = myArray[0] print(firstElement) # Append elements to the array myArray.append(4) print(myArray) # Remove elements from the array myArray.pop(1) print(myArray)In summary, the java.util Vector is a class in the Java Standard Library that allows for the storage and manipulation of objects in a resizable array-like data structure. There is no equivalent in the Python Standard Library, but the "array" module provides a similar functionality for working with dense arrays of numeric data.