Choose the correct option based on this program:.
import java.util.Arrays; public class Main { public static void main(String[] args) { String[] brics = {"Brazil", "Russia", "India", "China"}; Arrays.sort(brics, null); // LINE A for(String country : brics) { System.out.print(country + " "); }//from w ww. j a va2 s. com } }
InvalidComparatorException
when executing the line marked with comment line aC.
When null is passed as a second argument to the Arrays.sort()
method, it means that the default Comparable (i.e., natural ordering for the elements) should be used.
the default Comparator results in sorting the elements in ascending order.
the program does not result in a NullPointerException or any other exceptions or a compiler error.