《JAVA程序设计》复习题之(三)阅读程序题
(计算机科学与技术专业使用)
三、程序阅读题
1.阅读以下程序
import java.io.*;
public class Reverse2 {
public static void main(String args[ ]){
int i,n=10;
int a[] = new int[10];
try {
BufferedReader br = new BufferedReader(
new InputStreamReader(System.in));
a[i] = Integer.parseInt(br.readLine() );
} catch (IOException e) { };
for (i= n-1; i >= 0; i=i-2)
System.out.print(a[i]+" ");
System.out.println();
}
}
请写出该程序的功能:
该程序使用字符缓冲输入流从键盘输入10个数,然后倒序并间隔打印出来。
2.阅读以下程序
import java.io.* ;
public class abc {
public static void main(String args[ ]) {
int i, s = 0 ;
int a[] = { 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 12