Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
Free Bestselling eBooks

Free national bestsellers for your eReader - Fiction, Nonfiction & more! Join 1.5 million book lovers now. Sign-up in under 10 seconds to get the free daily email.
From our sponsors
java程式問題
Dec 27th 2013, 08:32

以下程式是"輸入10個數值,放入陣列中,並做排序"
String S1;
Integer sort[] = new Integer[10];
for (int i=0;i
{
S1 = JOptionPane.showInputDialog("請輸入一個整數進行排序:");
sort[i] = Integer.parseInt(S1);
}
Arrays.sort(sort); //利用Arrays.sort做排序
for (int ary : sort)
System.out.print(ary+" | ");

//利用Math.max()找出最大值
int temp = sort[0]; //使temp=第一個值
for (int i=0;i<sort.length;i++)
temp = Math.max(temp, sort[i]);
int max = temp;
System.out.println("\n最大值= "+max);

Q1
執行順序是?

Q2
如果我不想只設定成10個數字呢?
需要改哪裡讓程式為彈性?(意思是輸入多少個數字都可以)

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 jmuko104 的頭像
    jmuko104

    new htc one開箱,htc手機評價,htc手機比較,htc手機遊戲,htc手機維修,htc手機價位,htc手機推薦,htc手機鈴聲,中華電信htc手機,htc手機截圖,亞太htc手機,

    jmuko104 發表在 痞客邦 留言(0) 人氣()