Question: What happens when calling the following method with a non-null and non-empty array? A. It adds an element to the array the value of which
What happens when calling the following method with a non-null and non-empty array?
![public static void addStation Name (String[] names) { names [names.length] = "Times](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1707/2/9/7/02965c34905bd5e81707297029704.jpg)
A. It adds an element to the array the value of which is Times Square.
B. It replaces the last element in the array with the value Times Square.
C. It does not compile.
D. It throws an exception.
E. None of the above.
public static void addStation Name (String[] names) { names [names.length] = "Times Square"; }
Step by Step Solution
3.41 Rating (148 Votes )
There are 3 Steps involved in it
The image shows a Java method named addStationName which takes an array of Strings as a parameter Ho... View full answer
Get step-by-step solutions from verified subject matter experts
