1.java control statements can be divided into seven types
1) Control selection Structure statement:
If, if Else
Switch
2) Control loop Structure statement:
For, While,do while
3) Change the order of the control statements
Break, continue
Break is used to end the loop, and the continue is used to end the loop directly into the next loop.
Return is used to end the method.
2 How do I name A For loop?
For example a:for (int i=0;i<5;++i)
Indicates that the name of this for loop is a
3
public class breaktest1{
public static void Main (string[] args) {
a:for (int i=5;i>0;i--) {
for (int j=0;j<i;j++) {
if (j=2) {
Break A;
}
System.out.println (j);
}
System.out.println ();
}
}
}
There's nothing to end after break. It must be the current nearest loop.
After break, if you follow the name of a for loop, the specified loop ends.
The same continue followed by the name of a loop, which also ends the specified loop.
7 Types of control statements for 20.java