I'm trying to pass a file to another method which takes a String as its argument, but when I compile it I get contradicting exceptions.
The method I'm calling is:
public static String sortThis(String inputFileName)
{
//code here
}
The code where I'm calling the method is:
tempFile1 = Sort2.sortThis(tempFile2.getPath());
and I get the exception:
incompatible types
Found: java.lang.String
Required: java.io.File
So if I just pass the file:
tempFile1 = Sort2.sortThis(tempFile2);
I get:
sortThis(java.lang.String) in Sort2 cannot be applied to (java.io.File)
Am I using the wrong method of File to get the file name/path? I'm not sure what the difference is between getAbsolutePath(), getCanonicalPath(), and getPath(), so that could be the reason it's acting strangely?