Define an iterator class named PrimeIterator for iterating prime numbers. The constructor takes an argument that specifies

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 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: