Limited access

Upgrade to access all content for this subject

Arrays.sort() will sort the array parameter in ascending order.

String[] animals = {"jaguar", "PIG", "4 calves", "parrot", "#horses", "Bunny" };  
Arrays.sort(animals);

What are the elements in the animals array after the following code is executed?

A

animals = {jaguar, PIG, 4 calves, parrot, #horses, Bunny}

B

animals = {4 calves, Bunny, #horses, jaguar, parrot, PIG}

C

animals = {#horses, 4 calves, Bunny, jaguar, parrot, PIG}

D

animals = {#horses, 4 calves, Bunny, PIG, jaguar, parrot}

E

animals = {Bunny, PIG, jaguar, parrot, #horses, 4 calves}

Select an assignment template