Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception program error

 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




cannot resolve symbol error at line 1.but IOException subclass's are throwed here is accepted.right?Please help.
 
Anton Uwe
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code will compile if you insert the import for the FileNotFoundException.

import java.io.FileNotFoundException;

Since you declared main throwing IOException, any subclass of IOException will be "accepted" (but being "thrown" by main then).
[ January 12, 2007: Message edited by: Anton Uwe ]
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Shiva Mohan:


cannot resolve symbol error at line 1.but IOException subclass's are throwed here is accepted.right?Please help.


The problem is that the compiler doesn't know what a FileNotFoundException is. When you import a class, then you only get that class and not its subclasses.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic