Here is the code snippet for sorting
- import java.util.Arrays;
- public class Sorting
- {
- public static void main(String args[])
- {
- String[] strNames = new String[]
- {
- "Beans", "Jelly", "Drive", "Language", "Mark", "Run"
- };
- Arrays.sort(strNames);
- System.out.println("String array after sorting:");
- for (int i = 0; i < strNames.length; i++)
- {
- System.out.println(strNames[i]);
- }
- }
- }
Thank you, keep learning and sharing