Semicolon after while in do-while statement

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
irateturbulent
Posts: 1
Joined: Tue Nov 12, 2024 4:58 am
Contact:

Semicolon after while in do-while statement

Post by irateturbulent »

Hello,

Is it mandatory to have the semicolon after while in do-while statement. I read it some where & it says it's not mandatory but when i don't give it i am getting compilation error.
So is there any code example to clarify my doubt?

Thanks in advance!

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: Semicolon after while in do-while statement

Post by admin »

Did you use the command line to test? Please post the code the code that you tried and that didn't compile.

posetinkle
Posts: 1
Joined: Wed Dec 04, 2024 2:35 am
Contact:

Re: Semicolon after while in do-while statement

Post by posetinkle »

Yes, the semicolon after `while` in a `do-while` statement is mandatory in Java. Without it, the code will not compile.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests