定义几个static的标志字段用于记录位置,个数等

解决方案 »

  1.   

    设置一个变量,保存当前更新到的 index
    比如
    String[] test = new String[50];
    int index = 0;for (int i = index; i < 10; ++i, ++index) {
        test[i] = "a";
    }for (int i = index; i < 10; ++i, ++index) {
        test[i] = "b";
    }
      

  2.   

    或者定义一个和array内容一样的list,通过比较每一个位置的元素,知道哪个没有被更新
      

  3.   

    设置一个变量,保存当前更新到的 index
    比如
    String[] test = new String[50];
    int index = 0;for (int i = index; i < 10; ++i, ++index) {
        test[i] = "a";
    }for (int i = index; i < 10; ++i, ++index) {
        test[i] = "b";
    }
      
     能这么用吗?能不能给再细一些,该怎么用呢
      

  4.   

    static int index=0;
    下次负值就可以记住起始位置了
      

  5.   

    不需要定义成 static 的,关键是看在什么地方定义。
    一般情况做,定义为一个类的成员可能会比定义为 static 的要好。
    编程的时候要尽量少定义 static 的变量。
      

  6.   

    设置一个一样大小的标志数组,boolean 型的,然后在这个标志数组里做标记