---
title: "What is the difference between a while statement and a do statement?"  
description: "What is the difference between a while statement and a do statement?"  
author: "Sumit Kesarwani"  
published: 2014-08-26  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/2021/what-is-the-difference-between-a-while-statement-and-a-do-statement  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# What is the difference between a while statement and a do statement?

A while statement checks at the beginning of a loop to see whether the next loop iteration should occur.

A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.

## Answers

### Answer by Sumit Kesarwani

A while statement checks at the beginning of a loop to see whether the next loop iteration should occur.

A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.


---

Original Source: https://www.mindstick.com/interview/2021/what-is-the-difference-between-a-while-statement-and-a-do-statement

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
