aspose file tools*
The moose likes Beginning Java and the fly likes about Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "about "Exception"" Watch "about "Exception"" New topic
Author

about "Exception"

Wesley Tai
Greenhorn

Joined: Sep 30, 2003
Posts: 6
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

Joined: Jul 22, 2000
Posts: 9047
    
  10
exists != exits
None of the choices have anything to do with an exits method, or whether or not the file uses it.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Wesley Tai
Greenhorn

Joined: Sep 30, 2003
Posts: 6
if use the method "exists" ?
Which is the answer?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about "Exception"