import java.util.Scanner ;
class Text_Print {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
System.out.println("请输入行数");
int x =sc.nextInt();
System.out.println("请输入列数");
int y =sc.nextInt();
getPrint(x,y);
}
public static void getPrint(int x,int y){
for (int i=1;i<=x ;i++ ) { //外循环 决定矩形的行数
for (int j=1;j<=y ;j++ ) { //内循环 决定矩形的列数
System.out.print("*");
}
System.out.println();
}
}
}
|
|