Implement this algorithm using an ArrayList of Integers that is initialized to the values from 2 to 100. Your program can iterate numerically through the ArrayList from index 0 to index size()-1 to get the current prime number, but should use an Iterator to scan through the remainder of the list to eliminate the multiples. You can use the listIterator method to retrieve the iterator starting at a specified index into the ArrayList. Output all remaining prime numbers to the console.
No comments:
Post a Comment