break可以在switch和循坏语句中使用
continue只能在循坏结构中使用
1.if ……else
int a=14;
int b=5;
if(a>b) {
System.out.println("a>b");
}else if(a<b) {
System.out.println("a<b");
}else {
System.out.println("a=b");
}
2.switch
char d='B';
switch(d) {
case 'A':
System.out.println("80~100");
break;
case 'B':
System.out.println("70~80");
break;
case 'C':
System.out.println("60~70");
break;
default:
System.out.println("60以下");
3.for循坏
String s="";
for(int a=1;a<10;a++) {
for(int b=1;b<=a;b++) {
s+=a+"*"+b+"="+(a*b)+" ";
}
s+="
";
}
System.out.println(s);
4.do……while
int a=1;
String s="";
do {
int b=a;
do {
s+=a+"*"+b+"="+(a*b)+" ";
b++;
}while(b<10);
s+="
";
a++;
}while(a<10);
System.out.println(s);
5.while
int a=1;
String s="";
while(a<10) {
int b=a;
while(b<10
) {
s+=a+"*"+b+"="+(a*b)+" ";
b++;
}
a++;
s+="
";
}
System.out.println(s);
}