Java Program to Sort an Array

Java Program to Sort an Array

By using Arrays sort() method we can sort.

public class JavaApplication1 {

  public static void main(String[] args) {
        
        
          String[] schoolbag = { "Java", "Android", "Kotlin", "Flutter" }; 
 
            Arrays.sort(schoolbag);
            for (String element : schoolbag) {
                 System.out.println(element);
            }

  }

}

Output

Android
Flutter
Java
Kotlin

 


Subscribe For Daily Updates

JAVA File IO examples

JAVA Date & Time Progamming Examples

JAVA Collections

Flutter Questions
Android Questions