|
-
Oct 22nd, 2001, 01:07 PM
#1
Thread Starter
Lively Member
New, just learning java...
Hi all, just to make sure everyone knows, I'm as new as new can be to Java. I'm a VB programmer trying desperately to explore other languages.
I was given a small project to learn on by debugging. I've got a few simple things out of the way, like case sensitive stuff and all, but now I'm lost.
Code:
for (int i = 0 ; i < 3; i++);
for (int j = 0; j < 3; j++)
for (int j = 0; j < 3; j++)
return "";
The red line shows an error when compiling. Cannot resolve symbol. Variable i.
Well, all the lines before it use the variable i and there doesn't seem to be a problem.
I know it's probably something ridiculously simple, but not knowing the language makes the easiest problems impossible.
Thank you!!
-
Oct 22nd, 2001, 01:33 PM
#2
Well ...
The thing is you are declaring and using the variables i and j in the for loop. It's OK in Java, but the problem with the red line is it uses the variable j once again. It declares it twice.
Get rid of the red line completely, and the code will work.
If you know C/C++, Java is very similar to these languages in terms of syntax.
.
-
Oct 22nd, 2001, 01:37 PM
#3
Thread Starter
Lively Member
Ha, not only do I not know java, I can't proof read either!
Sorry!! I guess I should have re-read what I copied in there. The red line should be...
if (square[i][j].setText() == ' ')
Sorry!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|