Keyword synchronized


S

Sander Rensen

Hello Java users,

I just started at a IT company and I am learning the Java Language. In Java
they use the keyword 'synchronized'. Where do I use this for? It also seems
that you can use it in a function declaration and in a statement. In which
curcumstances do I use the keyword synchronized in a function declaration
and when do I use it in a statement?

I hope somebody can help me. Thanks for you effort.

Best regards

Sander
 
Ad

Advertisements

R

Roland

Hello Java users,

I just started at a IT company and I am learning the Java Language. In Java
they use the keyword 'synchronized'. Where do I use this for? It also seems
that you can use it in a function declaration and in a statement. In which
curcumstances do I use the keyword synchronized in a function declaration
and when do I use it in a statement?

I hope somebody can help me. Thanks for you effort.

Best regards

Sander
See the Java tutorial section on locking objects
<http://java.sun.com/docs/books/tutorial/essential/threads/monitors.html>
and the section on threads
<http://java.sun.com/docs/books/tutorial/essential/threads/index.html>
--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
D

Dotty

Sander Rensen said:
Hello Java users,

I just started at a IT company and I am learning the Java Language. In Java
they use the keyword 'synchronized'. Where do I use this for? It also seems
that you can use it in a function declaration and in a statement. In which
curcumstances do I use the keyword synchronized in a function declaration
and when do I use it in a statement?

I hope somebody can help me. Thanks for you effort.

Best regards

Sander

get a book
 
Ad

Advertisements

T

Thomas G. Marshall

Sander Rensen coughed up:
Hello Java users,

I just started at a IT company and I am learning the Java Language.
In Java they use the keyword 'synchronized'. Where do I use this for?
It also seems that you can use it in a function declaration and in a
statement. In which curcumstances do I use the keyword synchronized
in a function declaration and when do I use it in a statement?

I hope somebody can help me. Thanks for you effort.

Best regards

Sander

You may have realized this from the other two replies, but in case you
haven't, I'll take this moment to spell it out for you.

What you have asked us for is an entire course in multi-threading. Find as
many tutorials online, and if you need a good java threading book, then
here's one I hear mentioned a lot:

http://www.amazon.com/exec/obidos/t...104-2193462-6374369?v=glance&s=books&n=507846

You can find the cheapest one here:

http://www.bublos.com/cgi-bin/cc.bublobot?isbn=0201310090&timer=10&geog=us

but it is sometimes referred to as not for absolute-rank beginners. {shrug}
 

Top