Converting a File Format Variable To String
I would be grateful if someone could help me. I need to change a file format variable to a string, but do not know how to do this.
What I am doing is shown in the below code:
File file;
file=filepicker.filechoice();
(I have created a variable called file which is in a FILE FORMAT. I have a class which gets the file using JFILECHOOSER. No problems here!)
data=analysis3.vowel(file);
What I want to do know is to use the class analysis3.vowel to do a process with the file. Here are the two key lines in analysis3.vowel which are causing the problems for me.
public static int[] vowel(File filename)
{
File inFile = new File(filename); // create File object
When I try compiling I get the following error:
analysis3.java:33: cannot find symbol
symbol : constructor File(java.io.File)
location: class java.io.File
File inFile = new File(filename); // create File object
^
1 error
The program does not like the filename in the second line. It works fine if filename is a string variable. So, I believe I need to (1) either change the filename to a string formatted variable or (2) do something different!
Please can anyone tell me how to do either solution?
Many thanks!