I'm sorting an array in Java, my inputs are {"a3", "a2", "a11", "b1", "b2", "b3", "c3", "c13", "c2"} and I want output {"a2", "a3", "a11", "b1", "b2", "b3", "c2", "c3", "c13"}
What I'm doing in below not returning proper results, any suggestions/code example appreciated
import java.util.Arrays;
public class Main
{
public static void main(String[] args) {
String[] var = {"a3", "a2", "a11", "b1", "b2", "b3", "c3", "c13", "c2"};
Arrays.sort(var);
System.out.println(Arrays.toString(var));
}
}
From above code I'm getting output [a11, a2, a3, b1, b2, b3, c13, c2, c3]