|
Synchronize the main method
|
|
03-29-2008, 03:48 PM
Post: #1
|
|||
|
|||
|
Synchronize the main method
Can we sychronize the main method?
|
|||
|
03-29-2008, 03:55 PM
Post: #2
|
|||
|
|||
|
RE: Synchronize the main method
What is the use of making the main method synzhronized. main is the entry point for the application and I think only one thread will be accessing this method
|
|||
|
03-29-2008, 03:58 PM
Post: #3
|
|||
|
|||
|
RE: Synchronize the main method
Yeah. We don't need to synchronize the main method. But even if you add the synchronized modifier to the main method it would work.
[java] public class Main { public synchronized static void main(String args[]){ System.out.println("main method..."); } } [/java] |
|||
|
09-21-2009, 03:36 PM
(This post was last modified: 09-21-2009 03:37 PM by kumarmanish.nitc.)
Post: #4
|
|||
|
|||
RE: Synchronize the main method
(03-29-2008 03:58 PM)albinjoseph Wrote: Yeah. We don't need to synchronize the main method. But even if you add the synchronized modifier to the main method it would work. why don't need to synchronize the main method. why don't we need to synchronize the main method. |
|||
|
09-22-2009, 02:54 PM
Post: #5
|
|||
|
|||
RE: Synchronize the main method
(09-21-2009 03:36 PM)kumarmanish.nitc Wrote:(03-29-2008 03:58 PM)albinjoseph Wrote: Yeah. We don't need to synchronize the main method. But even if you add the synchronized modifier to the main method it would work. http://www.javacodez.com/forums/synchron...html#pid55 |
|||
|
« Next Oldest | Next Newest »
|

Search
Member List
Calendar
Help




