Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • 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: 24215
37
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!