Just Began: Help needed with Arrays

I am just learning java, and would appreciate help for the problem below:

Given an array of ints, swap the first and last elements in the array. Return the modified array. The array length will be at least 1.

Here is my solution, which does not work:

public int[] swapEnds(int[] nums) {

int[] answer;

answer = new int[nums.length];

answer = nums;

answer[answer.length - 1] = nums[0];

answer[0] = nums[nums.length - 1];

return answer;

}

I cannot make the end of nums display as the beginning of int[] answer, it seems to be like a recessive gene, not showing up if answer[answer.length - 1] = nums[0]; is there.