Which is the Best Java Web Framework ?

Java - Things to know before your OCJP Exam - Threads

1. * Thread.yield() doesn't guarantee that the Thread will keep waiting until execution of other threads.

2. * run method can be called directly but in that case it doesn't initiate new thread.

3. invoking start twice on same thread leads to IllegalStateException.

4. * Sequence in which multiple runnable threads are executed is system dependent and cannot be predicted.

5. Only methods ( static , instance ) and blocks can be synchronized. Variables cannot be synchronized.

6. InterruptedException is the checked exception for sleep method.

7. sleep is a static method and puts the current thread to sleep for specified time.

8. If the synchronized block is on a string literal, all threads will try to get lock on a common object as its picked from String pool.

9. synchronized cannot be applied to a constructor.

10. wait and notify should be there in synchronized section only.

11. Overridden method run cannot throw any checked exception.

12. There are object spcific locks and class specific locks.

13. suspend() method is used to suspend the execution of a thread for a period of time. We can then restart the thread by using resume() method.

14. * yield and sleep are static methods of Thread Class. join is the instance method of Thread Class. wait, notify and notifyAll are methods of Object class.
Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus




×

Try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests.

It's updated daily and It's Awesome.


×

Try our new Java Practice Test tool.

There are more than 200 questions and expanding quickly. It's updated daily and It's Awesome.