本帖最後由 李泳霖 於 2023-9-10 11:57 編輯
1.題目說明:
請將檔案另存成JPA05.java,並編譯為JPA05.class
2.設計說明:
(1程式內有一陣列{"A","B","C","D","E","F","G","H","I","J"}。
(2)請使用陣列方式寫出反轉陣列的程式,顯示{"J","I","H","G","F","E","D","C","B","A"}。
(3)顯示如執行結果參考畫面。
- public class JPD05 {
- public static void main(String[] argv) {
- String[] data = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"};
- System.out.print("反轉陣列資料之前: ");
-
- ...
-
- reverse(data);
-
- System.out.print("反轉陣列資料之後: ");
-
- ...
- }
-
- public static void reverse(__________) {
- ...
- }
- }
複製代碼 |