Collection_Slip_Answers
Collection_Slip_Answers
Display
them by using Iterator interface.
*/
import java.util.*;
import java.util.*;
// Print the details by iterating over both the name and mobile number using Enumeration
while (names.hasMoreElements()) {
String name = names.nextElement();
String number = numbers.nextElement();
System.out.println(name + " - " + number);
}
}
}
/*
Write a Java program to accept 'n' integers from the user and store them in a collection. Display them in the sorted
order. The collection should not accept duplicate elements. (Use a suitable collection). Search for a particular
element using predefined search method in the Collection framework
*/
import java.util.*;
import java.util.*;
import java.util.*;
=================================================================================================
/*
Write a Java program to store city names and their STD codes using an appropriate collection and perform following
operations:
i. Add a new city and its code (No duplicates)
ii. Remove a city from the collection
Iii. Search for a city name and display the code
*/
import java.util.*;