I have just taken the code you posted above, fixed the for loop and ran it. It throws a divide by zero error. I'm damned if I know how you are capable of running the code you posted without getting...
Type: Posts; User: Junky
I have just taken the code you posted above, fixed the for loop and ran it. It throws a divide by zero error. I'm damned if I know how you are capable of running the code you posted without getting...
It might compile but when you run the code it will throw the out of bounds exception. If it doesn't then the code you are running and the code you posted are different. Please post the latest version...
Another problem
int[] primes = new int[whichPrime];
return primes[whichPrime];
This will cause an ArrayIndexOutOfBoundsException. If you create an array with a size of 10 then the valid...
The code you posted above doesn't even compile.
for (ndx = 0; ndx < numPrimes && testPrime % primes[ndx] != 0; ndx++
{
;
}
Incomplete for loop statement. You also have a missing statement...
String s = null;
System.out.println(s.length());
The above code will generate a null pointer exception because the s variable is null. On line 40 of your code you have done something similar. You...