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
- 
				irateturbulent
 - Posts: 1
 - Joined: Tue Nov 12, 2024 4:58 am
 - Contact:
 
		Online		
						
						
		
				
		
		
	- 
				admin
 - Site Admin
 - Posts: 10443
 - 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.
			
			
									
									
						- 
				posetinkle
 - 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: Bing [Bot] and 30 guests