Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A message without SysOut, How ?  RSS feed

 
Po wong
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand the 8th line, how is it possible to write the message without a System.out.prinln. Is there a mistake in the code below ( "you must set.......)

 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

When you add an optional String to the constructor of an Exception, this message can be retrieved by the Exception's getMessage() method. So technically, line 8 doesn't write to the output at all, but the code that catches the Exception may.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!