aspose file tools*
The moose likes Threads and Synchronization and the fly likes join() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "join()" Watch "join()" New topic
Author

join()

cybel sheriden
Ranch Hand

Joined: Jan 18, 2005
Posts: 50
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
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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.


[Jess in Action][AskingGoodQuestions]
cybel sheriden
Ranch Hand

Joined: Jan 18, 2005
Posts: 50
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

Joined: Feb 18, 2005
Posts: 162
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.


SCJP 1.4 (100%) Done.<br />SCJD (URLyBird 1.2.3 Started)
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
you type clear more English try as post not clear is very.


42
 
Don't get me started about those stupid light bulbs.
 
subject: join()