Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about "Exception"

 
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: 9059
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?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic