An array reference variable can be used in which of the foll
An array reference variable can be used in which of the following ways? a. As a local variable b. As a parameter of a method c. As a return value of a method d. All of the above
Solution
int[] function()
{
// array used as a local variable
int one[] = {1,3,4,5,-1};
// return array from function
return one;
}
// array used as a local variable
int one[] = {1,3,4,5,-1};
int size = 5;
// array reference passed to method
function(one,size);
An array can be used a local variable and can be passed to and method and returned from any method as well.
Answer => (d)
