Click to See Complete Forum and Search --> : Grounds Up Java Tutorial (Primes)
mfocardi
02-03-2003, 11:08 AM
The Primes.class tutorial/example doesn't compile - there is an error at statement 32: cnt; Error generated is 'not a statement'. can anyone help? As you may guess, I am new to java. thanks.
29: while ( cnt > 0 ) {
30: if ( isPrime(sta) ) {
31: arr[idx++] = sta;
32: cnt;
33: }
34: sta++;
35: }
khalidali63
02-03-2003, 11:11 AM
I beg your pardon,
Your question does not make any sense for JavaScript forum.
You can either elaborate more or please post your question in a relative(Java) forum
thanks
Khalid
Zach Elfers
02-03-2003, 11:15 AM
Java is not the same as JavaScript.
It sounds like you have an older compiler.
Vamsee Krishna
02-03-2003, 12:34 PM
Originally posted by mfocardi
The Primes.class tutorial/example doesn't compile - there is an error at statement 32: cnt; Error generated is 'not a statement'. can anyone help? As you may guess, I am new to java. thanks.
29: while ( cnt > 0 ) {
30: if ( isPrime(sta) ) {
31: arr[idx++] = sta;
32: cnt;
33: }
34: sta++;
35: }
You cannot have a statement like "some variable name";
or nothing;
it should be something like cnt++ or cnt--; since you have to get out of the while loop, i think it should be cnt--;
hope it helps
mfocardi
02-03-2003, 01:37 PM
Vamsee,
thanks very much - that helped tremendously and I can now proceed. M.