Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

cant file symbol error trying to create a file object

$
0
0
hi,i am creating method to load a file to a scanner ready to read and i am having truble with a Cannot find symbol error

public static Scanner loadHistory()
	{
		// load the file
  		Scanner inFile = null;
  		try {
  			File myFile = new File("history.txt");
  			inFile = new Scanner(myFile);
  		}
  		catch(FileNotFoundException e){
  			System.out.println("error file not found program is closing");
  			System.exit(0);
  		}
  		
  		return inFile;
  	}



error is on line 6

anyone know the cause?
and feedback is appreciated
thanks dale

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>