java 输入n行n列的星号

package com.minrisoft;
import java.util.Scanner;
public class Java {
public static void main(String[] args){
Scanner yuan=new Scanner(System.in);
   System.out.println("请输入几行: ");
   System.out.println("请输入几列:");
   int n=yuan.nextInt();
   int y=yuan.nextInt();
for(int j=1;j<=n;j++){
for(int i=1;i<=y;i++){
System.out.print("*");
}
System.out.print("\n");
}
}
}

你可能感兴趣的:(java,java,输入n行n列的星号)