Capsud
Capsud

Reputation: 609

Help with a sort method

If i have an array of strings for example

Static final String[] TEST = new String[] { "g","a","b","t","e" };

How would i go about sorting this in alphabetical order please?

Upvotes: 0

Views: 91

Answers (2)

Peter Lawrey
Peter Lawrey

Reputation: 533890

Another example.

static final String[] TEST = "gabte".split("");
static {
   Arrays.sort(TEST);
}

Upvotes: 0

Brett Kail
Brett Kail

Reputation: 33956

import java.util.Arrays;

Arrays.sort(TEST);

Upvotes: 1

Related Questions