a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 144|回复: 0

[考试试题] 2012JAVA模拟试题及答案:编程题35

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
【程序35】   
" i% K9 C. ~* q题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。   
9 J1 W# s- c4 S+ Y0 S, {9 x0 _import java.util.*; 0 Q, O6 M4 ]% D$ }, V" ]. Z
public class lianxi35 {
) z" m  j9 W. wpublic static void main(String[] args) {
8 h: R. N6 P, l, N- [: {7 }   int N = 8; 6 k4 W- @  e- g. p5 x4 E
   int[] a = new int [N]; # C* d$ K; E5 x. Q* s$ m3 E
   Scanner s = new Scanner(System.in);
+ n/ V' {; T5 I% l9 c1 h: D   int idx1 = 0, idx2 = 0;
8 y1 Z% O( \, f* R$ S   System.out.println("请输入8个整数:"); / h5 V  {/ Q2 d1 ~2 l
   for(int i=0; i
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-6 03:32 , Processed in 0.218171 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表