Program flow control of Java

Sequential structure: the code is executed from top to bottom;

Branch structure:

if () {

} else{

}

if () {

} else if () {

} else {

}

Switch (constant){

Case constant:

Statement;

  break;

Case constant:

Statement;

  break;

default:

Statement;

  break;

}

Swich related rules:

When to use if and switch?

Cycle structure:

for (int i=0;i<100;i++) {}

While (logical operation, for example: I < 100){

  i++

}

do {

  i++

} while(i<100)

Circular nested structure;

Use of break, continue and return;

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
分享
二维码
< <上一篇
下一篇>>