Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

join()  RSS feed

 
cybel sheriden
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
join() method should always be placed in a try catch clause as it might throw intruppted Exception.

is tht correct as it was not mentioned in K&b.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, strictly, it doesn't have to be in a try block; it could be in a method that declared that it throws InterruptedException (or a superclass.) But the compiler will insist on your doing one of these two things.
 
cybel sheriden
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so in the exam if a join()method is not enclosed in try catch clause ,i should choose that it would give complier error.
 
Georgy Bolyuba
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by cybel sheriden:
so in the exam if a join()method is not enclosed in try catch clause ,i should choose that it would give complier error.


If method that contains join() is declared with 'throws InterruptedException' you may not use try{}catch(){}; So if it's true there is no any error.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you type clear more English try as post not clear is very.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!