The code works when I used java.util.Arrays.sort(numbers);
Am I doing something wrong? This seems weird to me.
import java.util.Arrays.*;
class
you need to do a static import. Use the following
import static java.util.Arrays.*;
Reason
when you want to import some static members (methods or variables), you need to static import the members. So you have to use import static
Another solution
or you can import
import java.util.Arrays;
and use
Arrays.sort(b);
Reason of the second Solution
here you are not importing any static elements so normal import to Arrays is needed. Then you can directly access using Arrays.sort