import java.io.File;
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.Comparator;
import java.io.FileNotFoundException;


public class ascendingOrder {

public static void main (String [] args) throws FileNotFoundException {
File text = new File ("testdata.txt");
Scanner scanFile = new Scanner (text);
while (scanFile.hasNextLine()) {
String reg = scanFile.nextLine();
String course = scanFile.nextLine();

System.out.println(reg + "\n" + course);
Arrays.sort(reg); // the error starts here
Arrays.sort(course);
System.out.println("After sort : " + "\n" + reg + course);
}
}
}