why?
package zh.codegym.task.task07.task0713;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
玩 Javarella
*/
public class Solution {
public static void main(String[] args) throws Exception {
//在此编写你的代码
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list=new ArrayList<>(20);
//添加元素
for(int i=0;i<20;i++){
String s=reader.readLine();
/*if(s.isEmpty())
break;
int x=Integer.parseInt(s);
list.add(x);*/
Integer x=Integer.parseInt(s);
list.add(x);
}
ArrayList<Integer> odd=new ArrayList<>();
ArrayList<Integer> even=new ArrayList<>();
ArrayList<Integer> other=new ArrayList<>();
for(int i=0;i<20;i++){
if(list.get(i)%2==0)
odd.add(list.get(i));
if(list.get(i)%3==0)
even.add(list.get(i));
if(list.get(i)%2!=0&&list.get(i)%3!=0)
other.add(list.get(i));
}
printList(even);
printList(odd);
printList(other);
}
public static void printList(List<Integer> list) {
//在此编写你的代码
if(list.size()==0)
return;
System.out.println(list.get(0));
}
}