Link to home
Start Free TrialLog in
Avatar of JAVAnewbie
JAVAnewbie

asked on

Some question about Thread

I have come across the java tutorial at:
http://java.sun.com/docs/books/tutorial/essential/threads/

and i was confused... and i hope experts here can give me a clear explanation about:

1) Thread
i know what is a thread, but how can we use it?

2) Runnable
what is runnable? how to use it?

3) Timer
how to use? what is does? and most importantly, what is it?

4) TimerTask
how to use? what is does? and most importantly, what is it?

5) i think i've seen
 Thread aThread = new Thread(new Runnable(){...});
before..(not quite sure the real code).. what it does?

6) what is synchronization? how to "use" it? or make sth synchronize?

*My English is very bad, so, please make your explanation simple, with example...

Tks

PS: i allocate 50 pts for each answer, totalling to 300.

SOLUTION
Avatar of applekanna
applekanna

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JAVAnewbie
JAVAnewbie

ASKER

checked, but still not quite clear about it.
a thread is a process.

it is something like this,

u go to a gas station and ask someone to fill the gas while you go inisde and have a beer.
u do this because filling gas and drinking beer and diffrent process and do not affect each other and can be done in any order.

the act of calling someoneFillGas() is writen in a thread

somefileGas will be in class that extends threads and has a run() method

try this
http://www.ecs.umass.edu/ece/wireless/people/emmanuel/java/java/threads/simple.html

Hope this helps.
Cheers
;)

i will definitely wait til all my question being answered then i allocate my pts.. ;)
tks so very much!
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thx for the points :)
:-)
:) Glad to help . . .