The code you provided is written in Java and demonstrates the use of the Collections.replaceAll() method to replace specific elements in a Vector with a new value. Here's how the code works:
import java.util.*; public class Replace_Element { public static void main(String[] args) { Vector < Integer > vec_list = new Vector < Integer > (); vec_list.add(10); vec_list.add(20); vec_list.add(30); vec_list.add(40); vec_list.add(50); System.out.println("Vector Elements : " + vec_list); Collections.replaceAll(vec_list, 30, 300); System.out.println("Vector elements: " + vec_list); } }
Vector Elements : [10, 20, 30, 40, 50] Vector elements: [10, 20, 300, 40, 50]
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions