in loop structure,whether content after break and continue will be executed?`

                    while(i<=a.length)
                    {
                        idx=i-1;
                        if(a[idx]>=b[jdx])
                        {
                            missionStatus=true;
                            i++;

                            break;
                            System.out.printf("judge whether content after break will be executed");

                        }
                        else
                        {
                            missionStatus=false;
                            i++;
                            continue;
                            System.out.printf("judge whether content after continue will be executed");

                        }

                    }

then complie,the compiler will report unreachable code

Warrior_Dragon.java:136: error: unreachable statement
							System.out.printf("judge whether content after break will be executed");
							^
Warrior_Dragon.java:144: error: unreachable statement
							System.out.printf("judge whether content after continue will be executed");
							^
2 errors

 

 

so it means the content after break and continue won't be executed

posted @ 2022-08-02 01:50  MikeLi  阅读(37)  评论(0编辑  收藏  举报