Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind Java Arrays. sort() Method?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Fill blank
Complete the missing token from the example code.
___[] cars = {"Volvo", "BMW", "Tesla", "Ford", "Fiat", "Mazda", "Audi"};3Order
Put the learning moves in the order that makes the concept easiest to apply.
The sort() method sorts an array in ascending order.
Definition and Usage
Java Arrays. sort() Method
❮ 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 ) |