public class Text4
{
public void modifyB(int[] b);
{
b [1]=87;
}
public static void main(String[] args)
{
int b []=new b[100];
b [1]=45;
System.out.println(b [1]);
Text4 one=new Text4();
one.modifyB(b);
System.out.println(b [1]);
}
}

解决方案 »

  1.   

    public class Text4 {
    public void modifyB(int[] b) {
    b[1] = 87;
    } public static void main(String[] args) {
    int b[] = new int[100];
    b[1] = 45;
    System.out.println(b[1]);
    Text4 one = new Text4();
    one.modifyB(b);
    System.out.println(b[1]);
    }
    }
      

  2.   

    public void modifyB(int[] b); 多了个分号
    int b []=new b[100];改成int b []=new int[100];
      

  3.   

     class Text4
    {
    public void modifyB(int[] b)
    {
    b [1]=87;
    }
    public static void main(String[] args) throws Exception
    {
    int b []=new int[100];
    b [1]=45;
    System.out.println(b[1]);
    Text4 one=new Text4();
    one.modifyB(b);
    System.out.println(b [1]);
    }
    }
      

  4.   

    public class Text4
    {
    public void modifyB(int[] b)
    {
    b [1]=87;
    }
    public static void main(String[] args)
    {
    int b []=new int[100];
    b [1]=45;
    System.out.println(b[1]);
    Text4 one=new Text4();
    one.modifyB(b);
    System.out.println(b[1]);
    }
    }
    int b []=new int[100];而不是 new b[100],因为你new 的是一个int数组,还有你的
    public void modifyB(int[] b)
    后面躲了一个分号
      

  5.   

    package hmily;public class Test
    {
    public void modifyB(int[] b)
    {
    b [1]=87;
    }
    public static void main(String[] args)
    {
    int [] b = new int [100];
    b [1]=45;
    System.out.println(b [1]);
    Test one=new Test();
    one.modifyB(b);
    System.out.println(b [1]);
    }
    }