类里可以定义任意多方法,
main中(任何方法中)不能再定义方法

解决方案 »

  1.   

    public class Ja{
    public static void main(String s[])
    {
    String g;
    g="number\tping\tli\t";
    for(int i=0;i<=10;i++)
                      {
                           String square = Integer(square(i)).toString;
                           String cube   = Integer(cube(i)).toString;
    g+="\n"+i+"\t"+square+"\t"+cube;
                      }
    System.out.print(g);
              }
    public Integer square (Integer x)
    {
                      int xx = x.intValue();
                      Integer result = new Integer(xx*xx)
    return result;
    }
    public Integer cube (Integer y)
    {
                      int yy = y.intValue();
                      Integer result = new Integer(yy*yy*yy)
    return result;
    }
    }
      

  2.   

    main不能在定义方法了,只能使用方法了。