亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

能用Scanner實現數組的手動輸入嗎?

能用Scanner實現數組的手動輸入嗎?

慕粉3703169 2016-07-27 16:34:41
package com.sTudent;import java.util.Arrays;public class stuDent {? public static void main(String[] args) { stuDent hello=new stuDent(); hello.Dges();}? public int Dges(){ ?int[] ages={18,23,21,19,25,29,17}; ?Arrays.sort(ages); ?int max=ages[0]; ?int min=ages[0]; ?for(int i=0;i<ages.length;i++){ ?if(ages[i]>max){max=ages[i];} ?else if(ages[i]<min){min=ages[i];} ?} ?System.out.println("年齡按從小到大排序后為:"+Arrays.toString(ages)); ?System.out.println("最大的年齡為:"+max); ?System.out.println("最小的年齡為:"+min); ?return min;? }}
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 4418 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號