Q.– 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:
class Test {
public static void main(String args) {
int numbers[ ] = {12, 15, 42, 32, 17, 116, 28, 51, 11);
int[ ] keys = findMax (numbers);
}
/* line n1 */ {
int[ ] keys = new int [3];
/* code goes here */
return keys;
}
}
Which method signature do you use at line n1?
A) public int findMax (int [ ] numbers)
B) static int findMax (int [ ] numbers)
C) final int findMax (int[ ])
D) static int[ ] findMax (int [ ] max)
⧪ please give your answer in a comment section.
Given the code fragment:
class Test {
public static void main(String args) {
int numbers[ ] = {12, 15, 42, 32, 17, 116, 28, 51, 11);
int[ ] keys = findMax (numbers);
}
/* line n1 */ {
int[ ] keys = new int [3];
/* code goes here */
return keys;
}
}
Which method signature do you use at line n1?
A) public int findMax (int [ ] numbers)
B) static int findMax (int [ ] numbers)
C) final int findMax (int[ ])
D) static int[ ] findMax (int [ ] max)
⧪ please give your answer in a comment section.
2 Comments
C
ReplyDeleteD
ReplyDeletestatic int[ ] findMax (int [ ] max) {
int[ ] keys = new int [3];
/* code goes here */
return keys;
}