import java.util.Scanner;public class Main{ public static int[] Test(int[] a){ int [] b =new int [1001]; for (int i =0;i<1001;i++){ b[i] = 0; } int len = a.length; for (int i =0;i
第二个方法:
import java.util.ArrayList;import java.util.Collections;import java.util.Iterator;import java.util.List;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); do{ int n=0,m=0,i=0; Listlist=new ArrayList (); n=scanner.nextInt(); for(i=0;i iterator=list.iterator(); while(iterator.hasNext()){ System.out.println(iterator.next()); } }while(!(scanner.hasNext("a"))); }}
此方法存在漏洞: