Question: Java Implement a program that creates a Java Interface that iterates through objects in some sort of collection. Enumerate Interface methods hasNext - Returns true
Java
Implement a program that creates a Java Interface that iterates through objects in some sort of collection.
- Enumerate Interface methods
- hasNext - Returns true if another element in the collection exists
- getNext - Returns the next element in the collection as an Object class object.
- NameCollection class
- Implements the Enumerate Interface
- Constructor takes in an array of names (Strings) and stores that array
- NameCollectionTester class
- Creates a NameCollection object
- Displays all the names in the NameCollection Object.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
