Write (define) a public static method named getAllButLast, that takes an Array of int as an argument and returns a new Array of int with all of the values in the argument array except the last value. For example, given the following Array declaration and instantiation: int[] myArray = {1, 22, 333, 400, 5005, 9}; getAllButLast(myArray) will return an Array of int with these values {1, 22, 333, 400, 5005} You may wish to write some additional code to test your method. ---------------------------------------------- public class Main { public static void main(String[] args) { // you may wish to write some code in this main method // to test your method. } }
Write (define) a public static method named getAllButLast, that takes an Array of int as an argument and returns a new Array of int with all of the values in the argument array except the last value.
For example, given the following Array declaration and instantiation:
int[] myArray = {1, 22, 333, 400, 5005, 9};
getAllButLast(myArray) will return an Array of int with these values {1, 22, 333, 400, 5005}
You may wish to write some additional code to test your method.
----------------------------------------------
public class Main {
public static void main(String[] args) {
// you may wish to write some code in this main method
// to test your method.
}
<your method definition here>
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images