Home  >  Article  >  Java  >  What is the difference between for statement and while statement in java

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

王林
王林Original
2020-04-30 14:06:384653browse

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!

Statement:
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