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: 10384
- 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.
-
- Posts: 1
- Joined: Wed Dec 04, 2024 2:35 am
- 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 10 guests