class ForPrint
{
    /*
    *
    *
    *
    */
    public static void print(int x,int y) throws XyException
    {
        if(x<=0||y<=0)
            throw new XyException("x or y <=0");
        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) 
    {
        int x=Integer.parseInt(args[0]);
        int y=Integer.parseInt(args[1]);
        try{
        print(x,y);
    if(args.length!=2)
           System.out.println("Use :java ForPrint 10 10");
        
        }
        catch(XyException e)
        {
          System.out.println(x);
          System.out.println(y);
          System.out.println(e.getMessage());
          e.printStackTrace();
         }
        catch(Exception e)
        {
          System.out.println(e.getMessage());
         }
        finally
        {
         System.out.println("打印出"+x+"×"+y+"的*矩阵!");
         }
        
    }
}
class XyException extends Exception
{
     public XyException(String msg)
     {
      super(msg);
      }
     
}
我想让程序打印出M*N的*矩形.
检查输入参数是否为2!否刚输出Use :java ForPrint 10 10
现在我输入java ForPrint 5只提示我数组越界.并没有打印java ForPrint 10 10请前辈们帮我分析一下!!!