import java.io.*; public class ax{ public static void main(String args[]) throws IOException{ int i,max=0; int a[]=new int[5]; for(i=0;i<=a.length-1;i++) {a=System.in.read(); System.in.skip(2);} for(i=0;i<=a.length-1;i++) System.out.println(+a); } } 这代码是输入5个数到数组里,然后将它输出. 我输入1,2,3,4,5它输出的结果怎么是49,50,51,52,53
楼上的回答正确,所以应该做如下的修改:可能不是最好的方法,有好的欢迎往上发:import java.io.*; public class ax{ public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int i,max=0; int a[]=new int[5]; System.out.println("Input datas,use enter to seperate them:"); for(i=0;i<=a.length-1;i++) { a[i]= Integer.parseInt(br.readLine()); } for(i=0;i<=a.length-1;i++) System.out.println(a[i]); } }