比如说第2个,第四个,或第八个位置满足if条件,
那么,我想在if{  }里,
把那些满足if条件的数字的位置放到一个数组里

解决方案 »

  1.   

    如果条件就这么简单,那就不用放了否则,数组啊,arraylist都可以啊。 如:list.add(i);
      

  2.   

    不可能啊有for循环在的,变量i也加不进啊
      

  3.   

    public boolean add(Object o)
    Appends the specified element to the end of this list (optional operation). 
    Lists that support this operation may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. List classes should clearly specify in their documentation any restrictions on what elements may be added.