The code you provided demonstrates how to access elements from a Vector in Java using the elementAt method. Here's a breakdown of what the code does:
import java.util.*; public class Get_Elements { public static void main(String[] args) { Vector < String > vec_list = new Vector < String > (); int ind = 3; vec_list.add("Apple"); vec_list.add("Banana"); vec_list.add("Cherry"); vec_list.add("Orange"); vec_list.add("Mango"); System.out.println("Vector Elements : " + vec_list); System.out.println("Element at index " + ind + " is : " + vec_list.elementAt(ind)); } }
Vector Elements : [Apple, Banana, Cherry, Orange, Mango] Element at index 3 is : Orange
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions