Do you know about Threats in Java?

@kingadnan (1538)
Pakistan
January 19, 2007 1:11am CST
I am very confuse with threats in java, i think they are use as a time interval, wel do you know about them, please tell me, i need help..
4 responses
• Egypt
20 Jan 07
Threading is easy. u can think about it as bringing another computer to work with the current one. When u need 2 things to work at the same time (for example loading the file while playing music) then u must put every operation in a separate thread. In Java, when u run the program there is the Main thread which runs ur code. U can create new threads and run them. There are 2 ways. First: extend the class Thread and override the method run() (put the code of operation here) then call its start() method Second: implement Runnable interface and write an implementation for run() method, then use this line "new Thread(this).start();" this will start the new thread. If u need more help just comment and I will reply.
1 person likes this
@kingadnan (1538)
• Pakistan
20 Jan 07
Oh thanks my friend now i understand little but i have to practice , thanks dude
• Indonesia
20 Jan 07
As long as i know, thread is used to execute two/more process in the same time. If you play a video game (ex : Pacman), the player and the enemy are moving together (simultant), right ?? this is the example of thread. If we are not using thread, the player will move first then the enemy move after the the player. CMIIW.
1 person likes this
@kingadnan (1538)
• Pakistan
20 Jan 07
Oh great thanks my friend i understand the concept but i can't use them, confusion
• Romania
19 Jan 07
i don't know anything about threaths...and i have not heard anything yet. i will inform you as soon as i get some news...
1 person likes this
• India
20 Jan 07
I think you are talking about the Threads in JAVA. I heard of them bu don't have clear idea about them. I learnt some of its concept during my college program but don't have command over it. Thanks.
1 person likes this
@kingadnan (1538)
• Pakistan
20 Jan 07
Yes Friend I mean Thread