The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Re: Java questions

Please explain why you think there might be anything wrong. Copy the program's output and paste it here with comments about what you think the problem is.

If you have questions please post them here, not a link.

One problem I see is that there are lots of for statements the do NOT have {}s to enclose the code in the for block. That will put a bug into the program the first time code is added to any of those for statements.

Re: Java questions

Please explain why you think there might be anything wrong. Copy the program's output and paste it here with comments about what you think the problem is.

If you have questions please post them here, not a link.

One problem I see is that there are lots of for statements the do NOT have {}s to enclose the code in the for block. That will put a bug into the program the first time code is added to any of those for statements.

To me it seems logically correct, it does not seem to give a compilation error even when i run it on something. It does look messy, however I dont get where in the logic it might be incorrect as no compilation error is given.

Re: Java questions

Because I do not have any reference paper where I can compare my answer with, and also I think there might have been some error in the if (gameLevel == 2) stage, because I feel there are too many conflicting if and nested ifs. Im not entirely sure if it is wrong or correct, which is why I posted to see if more experienced members could highlight the error in my code.

And you told me that it would put a bug in to my code because of the absence of {}s, so I tried to compile it, and there seems to be no error. However just because there are no compilation errors does not mean there doesn't exist a logic error?