close
一.題目
You are asked to create a method that accepts an array of integers and returns the highest value from that array.
(你被要求創造一可以接受數字陣列的,並回傳最大數字的方法)
Given the code fragment:
Which method signature do you use at line n1?
A. public int findMax (int[] numbers)
B. static int[] findMax (int[] max)
C. static int findMax (int[] numbers)
D. final int findMax (int[] )
二.答案
B
三.解析
建立一個方法,可以傳入int[]和回傳最大值,
findMax的參數是 numbers,那 numbers的型態是 int陣列,findMax的參數型態就是 int陣列,
findMax賦值給 keys,而 keys的型態是 int陣列,所以 findMax的回傳型態就是int陣列。
四.參考資料
文章標籤
全站熱搜
留言列表