JAVA::我这个代码打出来为什么不是矩形!!!跪谢!!!!!

来源:百度知道 编辑:UC知道 时间:2024/06/15 11:48:18
public class lesson2
{
public static void main(String [] args)
{

dramtemple(3,5);
dramtemple(2,4);
dramtemple(6,10);

}

static void dramtemple(int x,int y)
{
for(int i=0;i<x;i++)
{
for(int j=0;j<y;j++)

{System.out.print('*');}

System.out.println();
}

}

package chapter4;

public class lesson2 {
public static void main(String[] args) {

dramtemple(3, 5);
dramtemple(2, 4);
dramtemple(6, 10);

}

static void dramtemple(int x, int y) {
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++)

{
System.out.print('*');
}
System.out.println();//输出*后换行的地方错了
}
System.out.println();
}

}

public static void main(String[] args) {

dramtemple(3, 5);
dramtemple(2, 4);
dramtemple(6, 10);

}

static void dramtemple(int x, int y) {
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++)

{
System.out.print('*');
}
System.out.println();//这个挪到这就行了
}

}