The code you provided demonstrates how to retrieve and iterate over the elements of a Vector using an Enumeration in Java. Here's a breakdown of what the code does:
import java.util.*; public class Get_EnumValues { public static void main(String[] args) { Vector < String > vec_list = new Vector < String > (); vec_list.add("Apple"); vec_list.add("Grapes"); vec_list.add("Banana"); vec_list.add("Mango"); vec_list.add("Cherry"); vec_list.add("Orange"); Enumeration enum_val = vec_list.elements(); System.out.println("The Enumeration of Values are : "); while (enum_val.hasMoreElements()) { System.out.println(enum_val.nextElement()); } } }
The Enumeration of Values are : Apple Grapes Banana Mango Cherry Orange
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions