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!
Semicolon after while in do-while statement
Moderator: admin
-
- Posts: 1
- Joined: Tue Nov 12, 2024 4:58 am
- Contact:
-
- Site Admin
- Posts: 10270
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: Semicolon after while in do-while statement
Did you use the command line to test? Please post the code the code that you tried and that didn't compile.
If you like our products and services, please help us by posting your review here.
-
- Posts: 1
- Joined: Wed Dec 04, 2024 2:35 am
- Location: United Kingdom
- Contact:
Re: Semicolon after while in do-while statement
Yes, the semicolon after `while` in a `do-while` statement is mandatory in Java. Without it, the code will not compile.
Who is online
Users browsing this forum: No registered users and 12 guests