Home > Java > Javagetting Started > body text

What is the difference between for statement and while statement in java

王林
Release: 2020-04-30 14:06:38
Original
4752 people have browsed it

What is the difference between for statement and while statement in java

The difference between the for statement and the while statement is as follows:

Main manifestations:

(Video tutorial recommendation: java video)

From a memory perspective, after the for loop ends, the variable in the loop is released from the memory in time, and the variable can no longer be accessed outside the for loop; and after the while loop ends, it can still be accessed outside the while loop. This variable will be released when the GC is idle.

Recommended tutorial: java entry program

The above is the detailed content of What is the difference between for statement and while statement in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template