How to take the words written in a file and put them in an array


not only that, then I have to sort them alphabetically
Cannot use array.sort
Also if the word in the file starts with a number or lowercase it should print an error
" Invalid input. None of these words start with an uppercase.

This is what I have so far.

public class StringSorter {
private String inputFileName;
private String line;

public StringSorter(String fileName) {
	inputFileName = fileName;

public void sortStrings() throws IOException {
	FileReader input = new FileReader("MyFile.txt");
	String a = ("MyFile.txt");
	//BufferedReader myReader = new BufferedReader(input);

	for(int i = 0; i < a.length(); i++)
	    int smallest = i;
	    for(int j = i + 1; j < a.length(); j++) // here you find the index of the minimum String between the strings in the unsorted side of the array

I am stuck on where to proceed from here

I have to test it with this class .

public class TestStringSorter {

public static void main(String[] args) throws IOException {
	StringSorter sorterA = new StringSorter("MyFile.txt");
	StringSorter sorterB = new StringSorter("myOtherFile.txt");
	StringSorter sorterC = new StringSorter("yetAnotherFile.txt");



/* int i = 0;

	for( i = 0; i < a.length(); i++) {
		for(int j = i+1; j < a.length(); j++) {
			int temp=0;

			if(a[j].compareTo(a[i]) < 0)
				temp = j;

			String arrwords = a[i];
			a[i] = a[temp];
			arr[temp] = arrwords;
			for( i = 0; i < a.length(); i++) {
	} */

Tried this, but i kept getting " The type of the expression must be an array type but it resolved to String"

Super new to coding at my UNI