JAva書き込み正方形

459 ワード

int height = 5;
int width = 8;
for(int y = 0;y<=height;y++){
	for(int x=0;  x<=width;x++){
		if(((y ==0) || (y==height) ||(x == 0)) && (x!=width)){
					System.out.print("*");
					continue;
			}
			if( x == width  ){
				System.out.println("*");
				continue;
			} 
			System.out.print(" ");
				 
	}
}