A typical example of traversing an array using while statement autoincrement operation in Java

Output:

Summary:

Create an index variable index, which is used to specify the index of the array. As the index increases, the while loop will gradually traverse each element and output it to the console. Pay attention to the difference between + + index and index + +++ Index: the value of index will be incremented, and then the incremented value will be used. Index + +: first use the value of index, and then increment the value of the variable.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>