Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

about "Exception"  RSS feed

 
Wesley Tai
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question:
If f is an Object of "File" class, which paragraph of program codes is suitable to check if the file exits or not by the method "exits()"?
A.Exception e =new IOException("File not found.");
if(!f.exists())
throw e;
B.if(!f.exists())
throw new IOException("File"+f.getName()+"not found.");
C.if(!f.exist())
throw new IOException;
D.if(!f.exists())
throw "File Not Found";
E.if(!f.exists())
throw new IOException();
THANK YOU !
 
Marilyn de Queiroz
Sheriff
Posts: 9079
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
exists != exits
None of the choices have anything to do with an exits method, or whether or not the file uses it.
 
Wesley Tai
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if use the method "exists" ?
Which is the answer?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!