Question: Define an iterator class named PrimeIterator for iterating prime numbers. The constructor takes an argument that specifies the limit of the maximum prime number. For
Define an iterator class named PrimeIterator for iterating prime numbers. The constructor takes an argument that specifies the limit of the maximum prime number. For example, new PrimeIterator(23302) creates an iterator that iterates prime numbers less than or equal to 23302. Write a test program that uses this iterator to display all prime numbers less than or equal to 100000.
Step by Step Solution
3.45 Rating (164 Votes )
There are 3 Steps involved in it
Program Plan Create a TestPrimeIterator class and create one more inner class PrimeIterator that implements javautilIteratorof integer type In PrimeIterator class create one constructor and pass one a... View full answer
Get step-by-step solutions from verified subject matter experts
