Question: Write a method that take an argument and returns a value Write a method that takes an array as an argument Use an index value

Write a method that take an argument and returns a value
Write a method that takes an array as an argument
Use an index value to access an array element
Use the length property of an array to determine the size of the array
Write (define) a public static method named getLast, that takes an Array of int as an argument and returns the int value of the last element of the array.
For example, given the following Array declaration and instantiation:
int[] myArray ={1,22,333,400,5005,9};
getLast(myArray) will return 9
You may wish to write some additional code to test your method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!