My study has to use listarray function. However, the test codes I wrote in order to verify whether I can use this function cannot be operated.
the following is my code:
import java.util.ArrayList;
public class Test1
{
public static void main(String[] args)
{
ArrayList<integer>list=new ArrayList<integer>();
list.add(5);
list.add(3);
list.add(2);
list.add(4);
list.add(1);
for (int i=0;i<list.size()-1;i++)
{ for(int j=1;j<list.size()-i;j++)
{ integer a;
if((list.get(j-1)).compareTo(list.get(j))>0)
{ a=list.get(j-1);
list.set((j-1),list.get(j));
list.set(j,a);
}
}
}
for(integer s:list)
{ System.out.println(s.intValue());
}
}
}
Can somebody tell me where is the mistake, or whether this function is totally not allowed to be used in EFS editor.
Thanks a lot~
the following is my code:
import java.util.ArrayList;
public class Test1
{
public static void main(String[] args)
{
ArrayList<integer>list=new ArrayList<integer>();
list.add(5);
list.add(3);
list.add(2);
list.add(4);
list.add(1);
for (int i=0;i<list.size()-1;i++)
{ for(int j=1;j<list.size()-i;j++)
{ integer a;
if((list.get(j-1)).compareTo(list.get(j))>0)
{ a=list.get(j-1);
list.set((j-1),list.get(j));
list.set(j,a);
}
}
}
for(integer s:list)
{ System.out.println(s.intValue());
}
}
}
Can somebody tell me where is the mistake, or whether this function is totally not allowed to be used in EFS editor.
Thanks a lot~
Comment