Paweł Baczyński wrote:Your code won't compile, but let's assume you have numofHits == locationCells.length on line 8.
I don't quite understand your question.
First the loop is executed. It may or may not exit through break statement.
Then there is an if statement comparing numofHits with locationCells.length.
I am assuming numofHits was 0 before this code gets executed.
It looks like the condition from line 8 will can be true only if locationCells.length is equal to 0 or 1.
Manish Daryani wrote:Hi ! Can anyone please explain me that in the following, the break is used to come out of the for loop or if loop ?
I hope you understand by just a portion of code no one will be able to answer you properly. If you post complete code then someone who knows the answer can help you. Please use code tags to post code with proper indentation. You can refer these links for that. Click here ---> Use Code Tag and Java Programming StyleManish Daryani wrote:Do you want me to post the entire code?
[edit]CR removed quote because there is no point in writing the whole of the same post twice.Ganesh Patekar wrote:. . .
All things are lawful, but not all things are profitable.
Knute Snortum wrote:Did you forget to post the code?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |