Results 1 to 5 of 5
Thread: Threads and Synchronization
- 12-03-2009, 08:35 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 2
- Rep Power
- 0
Threads and Synchronization
HI !
I AM ASADUN, I HAVE STUDY THE BASIC OF JAVA LAST YEAR AND THIS YEAR I AM STUDYING JAVA ADVANCE BY MY SELF,I NEED YOUR HELP,COULD PLEASE EXPLAIN TO ME WITH SIMPLE WAY WHAT IS Threads and Synchronization, I REALLY TRIED TO READ MANY ARTICLES BUT STILL I DID NOT GET THE IDEA.
THANK
ASADUNLast edited by ASADUN; 12-03-2009 at 08:37 PM.
- 12-03-2009, 08:40 PM #2
Check out the Java tutorial on concurrency. It discusses threads and synchronization.
Also, for future reference, please don't put your posts in caps. When writing on-line, capital letters are interpreted as yelling.CodesAway - codesaway.info
writing tools that make writing code a little easier
- 12-07-2009, 01:49 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 2
- Rep Power
- 0
Hi !
Here is a class calls "tuna" with three constructors in some constructors I see there is "this",and I cannot understand why we use it in this case
Would like please explain to me what is the use for "this" in those constructors
public class tuna {
private int hour;
private int minute;
private int second;
public tuna(){
this(0,0,0);
}
public tuna(int h){
this(h,0,0);
}
public tuna(int h, int m){
this(h,m,0);
}
thanks
- 12-07-2009, 09:46 PM #4
In the future, please create a separate topic for each distinct question. Only if your comment/question is in response to the topic should you reuse a topic.
Now, as for your question. The "this" in your case is used to call another constructor in the class. So, in this case, all the constructors will be calling the three argument constructor (which is not in your example), but presumably would initialize the three fields to the the passed values.
Since Java doesn't allow a parameter to have a default value, this methodology can be used to reproduce the same functionality. In this case, if you omit any of the hour/minute/second values, 0 will be used instead. Then, the constructor with three arguments (one for each hour, minute, and second) will be used to initialize the fields.CodesAway - codesaway.info
writing tools that make writing code a little easier
- 12-18-2009, 07:00 AM #5
Member
- Join Date
- Dec 2009
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
Odd Even number synchronization in threads
By DukeNukem in forum Threads and SynchronizationReplies: 1Last Post: 03-16-2009, 02:02 PM -
Animation Synchronization
By dreadrocksean in forum Advanced JavaReplies: 5Last Post: 08-08-2008, 02:56 AM -
synchronization question
By oguz in forum Threads and SynchronizationReplies: 2Last Post: 07-22-2008, 08:56 AM -
Synchronization Doesn't seem to work
By sherinpearl in forum Threads and SynchronizationReplies: 1Last Post: 04-23-2008, 06:30 PM -
Synchronization problems
By Jack in forum Advanced JavaReplies: 2Last Post: 07-02-2007, 01:17 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks