yea i actually looked at both of those articles when i was trying to write the code to open the file. Here is the error:
Unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
FileReader fr = new FileReader ("input.in");
And then there is a arrow/hat pointing to the n on new.
Here is my code if it helps:
PHP Code:
import java.io.*;
class ride {
public static void main(String args[])
{
FileReader fr = new FileReader("input.in");
BufferedReader br = new BufferedReader(fr);
String record = null;
char[] charLetters = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
'U', 'V', 'W', 'X', 'Y', 'Z'};
try
{
while ( (record=br.readLine()) != null )
{
char[] charInput = record.toCharArray();
int[] no = new int[charInput.length];
for(int i=0; i<charInput.length; i++)
{
for(int j=1; j<=26; j++)
{
if(charInput[i] == charLetters[j])
{
no[i] = j;
System.out.println(" " + no[i]);
}
}
}
}
} catch (IOException e) {System.out.println("Error:"+e) ; }
}
}
Bookmarks