你的程序我怎么看不懂呢?
this("adfafaf",100);这句是什么意思?

解决方案 »

  1.   

    这句就是用this调用Method(String s, int i)函数哪!
      

  2.   

    应该显示s=null.i=0吧,因为“null”,应该上字符串null吧,i你定义的就是0啊,那个100根本就在方法里面的,你有没this.i=i所以当然是0咯~~~~
      

  3.   

    static String s = new String("null");
    你定义的是static,只能被初始化一次。
    你可以看看关于static的资料
      

  4.   

    晕,那s个参数亚。你并没有执行this.s = s 什么的操作阿。
      

  5.   

    在Method(String s, int i)方法中,传过来的参数没有用到,而在void print()方法里是没有参数的,所以打印出来的只是上面的变量。
      

  6.   

    public class Method {
    int i = 0; static String s = new String("null"); Method() 
    {
    this.s="adfafaf";
    this.i=100;
    } Method(String s, int i)
    {
    System.out.println("this sucess");
    } void print()
    {
    System.out.println("s = " + s + " i = " + i);
    } public static void main(String[] args) {
    Method t = new Method();
    t.print();
    }
    }
    这样就能得到你想要的结果了。
      

  7.   

    public class Method
    {
    int i = 0;
    static String s = new String("null");
     Method()
      { 
        this("adfafaf",100); 
      }
     Method(String s, int i)
      {
      this.s=s
      this.i=i  } 
     void print()
     {
      System.out.println("s = " + s + " i = " + i );
     }
    public static void main(String[] args)
     {
      Method t = new Method();
      t.print();
     }
    }
    就可以了.