编程输出如下空心菱形图片:
public class Rhombus {
public void rh(){
for(int i=1;i<=4;i++){
for(int j=1;j<=(4-i)*2;j++){
System.out.print(" ");
}
System.out.print("**");
for(int k=1;k<=4*i-6;k++){
System.out.print(" ");
}
if(i!=1){
System.out.print("**\n");
}
else
System.out.println();
}
for(int i=3;i>0;i--){
for(int j=1;j<=(4-i)*2;j++){
System.out.print(" ");
}
System.out.print("**");
for(int k=1;k<=4*i-6;k++){
System.out.print(" ");}
if(i!=1)System.out.print("**\n");
else System.out.println();
}
}
public static void main(String[]args){
Rhombus rh=new Rhombus();
rh.rh();
}
}