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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Convert IOException to String?" Watch "Convert IOException to String?" New topic
Author

Convert IOException to String?

John Reese
Greenhorn

Joined: Apr 04, 2009
Posts: 7
Hi,
I don't understand what type the exception below is. I can print it out which makes me think of the exception as a string. However, if I try to save it to a string, I get the following compilation error:

How can I save this as a string?
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
You could do
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Or Both can be what you want depending on what you want to be in the String exactly. The String returned by toString() includes the exception's class name and the message, unless it's null. getMessage() only returns the message, and that can be null.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert IOException to String?
 
Similar Threads
throwing an exception on a property set
Exception test
handle Exceptions from DB
Exception Doubt..
IOException