黑马程序员技术交流社区

标题: 任意长,宽的形状 [打印本页]

作者: 魔心邪    时间: 2015-5-2 01:05
标题: 任意长,宽的形状
import java.util.Scanner;
class San
{
        public static void main(String[] args)
        {
                Scanner as=new Scanner(System.in);
                System.out.println("");
                int x=as.nextInt();
                Scanner ac=new Scanner(System.in);
                System.out.println("");
                int y=ac.nextInt();
                get(x,y);
        }
        public static void get(int num,int count)
        {
                for (int x=0;x<num ;x++ )
                {
                        for (int y=0;y<count ;y++ )
                        {
               System.out.print("@");
                        }
                        System.out.println();
                }
        }
}
作者: Demomiku    时间: 2015-5-2 09:19
不必new 两个Scanner对象,可以重复使用的
作者: 1017161726    时间: 2015-5-2 09:57
哥们这头像真够流弊的啊。。话说你代码写的真好。
作者: yelebron    时间: 2015-5-2 10:16
还有一些待优化之处!!!!




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2