第四章 Java基础嵌套语句 函数 的详解
一.for 嵌套
例题1:package forxunhuan;
/**
* Created by Administrator on 2015/3/30.
*/
public class xhuhuan1 {
public static void main(String []args){
//大圈套小圈
for( int x = 0;x<3; x++){
for(int y = 0;y<4; y++){
System.out.print(“*”);
}
System.out.println();
}
}
}
例题2:package forxunhuan;
/**
* Created by Administrator on 2015/3/30.
*/
public class xhuhuan2 {
public static void main(String []args){
for(int x = 1;x<=5; x++){
for(int y = x;y<=5;y++){
System.out.print(“*”);
}
System.out.println();
}
}
}
例题3:package forxunhuan;
/**
* Created by Administrator on 2015/3/30.
*/
public class xhuhuan3 {
public static void main(String[] args){
for(int x = 1;x<=5; x++){
for(int y =1;y