This week's giveaway is in the Spring forum.
We're giving away four 3 month subscriptions to Marco Behler Videos and have Marco Behler on-line!
See this thread for details.
Win a 3 month subscription to Marco Behler Videos this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert IOException to String?  RSS feed

 
John Reese
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could do
 
Rob Spoor
Sheriff
Posts: 21021
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!