Get the App
SLTechnology News&Howtos  ›  Development  › 

Branch structure and Loop example Analysis of Java

Shulou Source: shulou.com Published: 2022-06-01 16:41:40 09月22日 Update

This article mainly introduces "the branch structure and loop case analysis of Java". In the daily operation, I believe that many people have doubts about the branch structure and loop case analysis of Java. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about the branch structure and loop case analysis of Java. Next, please follow the editor to study!

1.continue keyword

Continue: continue

Applicable scenarios: can only be used in loops

Function: means to jump out of this cycle and continue to execute the next cycle

The difference between break and continue?

Applicable to different scenarios, break can be used in switch and loops, continue can only be used in loops

The functions are different:

Break indicates that the loop is interrupted, and the number of unfinished cycles is no longer executed.

Continue says to jump out of this cycle and continue with the next cycle.

Package com.qfedu.test1;/** * continue: continue * applicable scenarios: can only be used in a loop * function: it means to jump out of this cycle and continue to execute the next cycle * * the difference between break and continue? * different scenarios: break can be used in switch and loops. Continue can only be used in loops. * break means to break the loop, and the number of unfinished cycles is no longer executed * continue means to jump out of the loop. Continue to execute the next cycle * @ author WHD * * / public class Test1 {public static void main (String [] args) {/ / apply for loop printing 1 ~ 10 when the value of I is 5, use break and continue to view the effect for (int I = 1) I

Tags: Loops functions elements counters inputs branches instances instance analysis structure analysis differences that is balances functions scenarios deposits passwords scores times conditions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Docker Apple Xiaomi MySQL