黑马程序员技术交流社区
标题:
学了循环 和Scanner 自己尝试弄得
[打印本页]
作者:
挖煤黑小伙
时间:
2015-5-26 21:28
标题:
学了循环 和Scanner 自己尝试弄得
/*
打印一个a行,b列的长方形
*/
import java.util.Scanner;
class Print
{
public static void main(String[] args)
{
Scanner a=new Scanner(System.in);
System.out.print("请输入行数:");
int x=a.nextInt();
Scanner b=new Scanner(System.in);
System.out.print("请输入列数:");
int y=b.nextInt();
printChangFangXing(x,y);
}
public static void printChangFangXing(int row,int col){
for (int x=0;x<row ;x++ )
{
for (int y=0;y<col ;y++ )
{
System.out.print("$");
}
System.out.println();
}
return;
}
}
作者:
!85684009ex
时间:
2015-5-26 21:30
膜拜大神!谢谢!
作者:
hellotaomi
时间:
2015-5-26 21:38
赞一个吧~
作者:
Z-CQ
时间:
2015-5-26 21:42
好给力啊,赞一个
作者:
守株人
时间:
2015-5-26 21:55
不错,赞一个
作者:
高强520
时间:
2015-5-26 21:58
膜拜大神!
作者:
雪域星辰
时间:
2015-5-26 22:34
BufferedReader也可以实现的。。。
作者:
lizhi
时间:
2015-5-26 22:38
return就不用了,这样不美观,嘿嘿
作者:
黯然残影
时间:
2015-5-27 00:15
不错,赞一个
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2