❮ Arrays Methods
String[] cars = {"Volvo", "BMW", "Tesla", "Ford", "Fiat", "Mazda", "Audi"};
Arrays.sort(cars);Definition and Usage
The sort() method sorts an array in ascending order.
This method sorts arrays of strings alphabetically, and arrays of integers numerically.
Syntax
Arrays.sort( array )Arrays.sort( array , start , end )Parameter Values
| Parameter | Description |
|---|---|
| array | Required. The array to be sorted |
| start | Optional. The index position of the first element (inclusive) to be sorted |
| end | Optional. The index position of the last element (exclusive) to be sorted |
Technical Details
| Returns: | No return value |
|---|---|
| Java version: | 1.2 ( java.util ) |