Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Certification
»
Programmer Certification (OCPJP)
Thread Synchronization
Sujittt Tripathyrr
,
Ranch Hand
Aug 16, 2006 03:59:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Hi
Can you please explain me what is the use of synchronized block and please give me a example.
Thanks
Srikanth Basa
,
Ranch Hand
Aug 16, 2006 04:30:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
I see the question you ask is more generic. Do you mean you need some tutorial or you were facing some issue ?
Gowher Naik
,
Ranch Hand
Aug 16, 2006 05:51:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
import static java.lang.System.out; class ThreadTest extends Thread{ public void run(){ synchronized(this){ for(int i=0;i<15;i++){ out.println(Thread.currentThread().getName()+i); } } } public static void main(String args[]){ new Thread(new ThreadTest(),"T1: ").start(); new Thread(new ThreadTest(),"T2: ").start(); } }
check code above
Post by:
autobot
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
This thread has been viewed 676 times.
Similar Threads
Teradata ????? does it has scope
ClassLoader problem :ClassCastException
Drop down box not working in IE7 but very well displayed in Mozzila
How to run my own jsp file?
Need your suggestion on ErrorHandling
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:46:32
.