Chapter 11 semantic error pg 295
In their try it out on page 295 they have a program that goes through primes and in the constructor they have
public Primes(long minimum, long maximum)
{
if (min < 2)
min = 2;
else
min = minimum;
what this does is it always puts min at the value of 2 no matter how you instance the class because if(min < 2) . At that point in the program mins value is always the same so it will always be less than 2. The watch window says it's value is at 0.... so even if you call the program with 200 minimum it will still display primes starting from 2.
It should be
if (minimum < 2)
|