import java.util.ArrayList; import java.util.List; public class Lint9 { /* * 判断能不能被整除 */ public static void main(String[] args) { // TODO Auto-generated method stub } public List<String> fizzBuzz(int n) { List<String> list = new ArrayList<>(); for (int i = 1; i <= n; i++) { if(i%3 == 0 && i%5 == 0) { list.add("fizz buzz"); continue; } else if(i%3 == 0) { list.add("fizz"); continue; } else if(i%5 == 0) { list.add("buzz"); continue; }else { list.add(i+""); } } return list; } }