SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Rob Spoor wrote:You can't name your variable final because that's a reserved word.
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla wrote:In the while loop (which you have highlighted in red) has a semicolon at the end which is not valid.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:
Mohamed Sanaulla wrote:In the while loop (which you have highlighted in red) has a semicolon at the end which is not valid.
It's valid, but it means the loop body is empty. Unless the loop condition turns itself to false the loop will run forever. One example from C is a (unsafe) string copy:
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Rob Spoor wrote:
Mohamed Sanaulla wrote:In the while loop (which you have highlighted in red) has a semicolon at the end which is not valid.
It's valid, but it means the loop body is empty.
Joanne
Mohamed Sanaulla wrote:
Rob Spoor wrote:
Mohamed Sanaulla wrote:In the while loop (which you have highlighted in red) has a semicolon at the end which is not valid.
It's valid, but it means the loop body is empty. Unless the loop condition turns itself to false the loop will run forever. One example from C is a (unsafe) string copy:
I thought it was only for for-loop. Thanks for correcting!
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Joanne Neal wrote:
Rob Spoor wrote:
Mohamed Sanaulla wrote:In the while loop (which you have highlighted in red) has a semicolon at the end which is not valid.
It's valid, but it means the loop body is empty.
It's also valid when it's at the end of a do/while loop which is the case in the OP's code (assuming we are talking about line 52 - the red seems to have disappeared)
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Joanne Neal wrote: (assuming we are talking about line 52 - the red seems to have disappeared)
Mohamed Sanaulla wrote:Oh I didnt see the do.. while there. I just thought it was only while loop.
Joanne