/*
So I have this code and I am getting incombatable types, I do not know why I am getting them... Can someone help me figure out why I am getting the error? (See: //Where the problem is)
The Error I am getting:
stringSort.java:26: error: incompatible types
if(myArray[j].compareToIgnoreCase(myArray[i].toString())){
^
required: boolean
found: int
*/
import java.util.*;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileNotFoundException;
public class stringSort{
public static void main(String[] args) throws Exception {
FileInputStream fstream = new FileInputStream("textfile.txt"); // Open the file
BufferedReader br = new BufferedReader(new InputStreamReader(fstream)); // allows file to be read
String strLine;
int count = Integer.parseInt(br.readLine());
String[] myArray = new String[count];
int i = 0;
while ((strLine = br.readLine()) != null){ //Read File Line By Line
myArray[i]= strLine;
i++;
}
// bubble sort
for(i=0; i<myArray.length; i++){ // while there are still lines left
for(int j=i+1; j<myArray.length; j++){
if(myArray[j].compareToIgnoreCase(myArray[i].toString())){ // where the problem is
swap(myArray,i,j);
}
}
}
br.close(); //Close the input stream
}
}