• Post Reply Bookmark Topic Watch Topic
  • New Topic

Threading and operation  RSS feed

 
Rahul Shilpakar
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In following code snipet i didn't understood the Line which are in bold words



In above code,

1. at LINE 0 why this object is made of class Object?
2. at LINE 1 what is the use of syncObj there?
3. at LINE 2 Does the g() mehtod anything to do with threading?

Thanks in advance.
 
Henry Wong
author
Sheriff
Posts: 22861
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. at LINE 0 why this object is made of class Object?

In line 0, ir is instantiating an object -- most likely for use as an syncrhonization object.

2. at LINE 1 what is the use of syncObj there?

As suspected from the previous point, the object is used as a syncrhonization object.

3. at LINE 2 Does the g() mehtod anything to do with threading?

Keep in mind that the main thread is still a thread. Just because you didn't start it doesn't mean that it doesn't relate to threading. It is still running concurrent to the threads that you started.

Henry
 
Rahul Shilpakar
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Henry. I got it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!