hey guys and gals,

newb back again with a little request from the Java Gods. in line 31 i've got an error saying "cannot find symbol"

NextRecord record = new NextRecord();

i've got 2! count 'em 2 Java books and i'm still stuck...Help?

import java.io.File;
import java.io.FileNotFoundException;
import java.lang.IllegalStateException;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class NumberStudy
{
private Scanner input;

//enable user to open file
public void openFile()
{
try
{
input = new Scanner(new File("numbers.txt"));
}// end try
catch (FileNotFoundException fileNotfoundException)
{
System.err.println( "Error opening file.");
System.exit(1);
}//end catch
}// end method openFile

//read record from file
public void nextInt()
{
//object to be written to screen
NextRecord record = new NextRecord();

System.out.printf( "%s%10s", "Rating ", "Frequency ");

try //read from the file using the scanner
{
while (input.hasNext())
{
record.setRating(input.nextInt());
record.setFrequency(input.next());

//display record contents
System.out.printf( "%s%10s", "Rating ", "Frequency ", record.getRating(), record.getFrequency());
} //end while
} // end try

catch(NoSuchElementException elementException)
{
System.err.println( "File imporperly formed.");
input.close();
System.exit(1);
}//end catch
catch (IllegalStateException stateException)
{
System.err.println("Error reading from file.");
System.exit(1);
}//end catch
}//end method nextInt

//close file and terminate application
public void closeFile()
{
if (input != null)
input.close(); //close file
}//end catch
}//end class NumberStudy

"i've got 2! count 'em 2 Java books and i'm still stuck...Help?"

I've got 200...

Quite obviously (learn to interpret error messages...) the compiler knows nothing about a class "NextRecord".

If I understand correctly, you are getting "can not resolve symbol" error on NextRecord...

If that is the case, then you need to "import" the package that contains "NextRecord" class.

If I understand correctly, you are getting "can not resolve symbol" error on NextRecord...

If that is the case, then you need to "import" the package that contains "NextRecord" class.

cool, i'll do that now.

This article has been dead for over six months. Start a new discussion instead.