Results 1 to 3 of 3

Thread: New, just learning java...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Fort Lauderdale, FL
    Posts
    98

    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!!

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    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.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Fort Lauderdale, FL
    Posts
    98
    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
  •  



Click Here to Expand Forum to Full Width