Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Synchronize the main method
03-29-2008, 03:48 PM
Post: #1
Synchronize the main method
Can we sychronize the main method?
Find all posts by this user
Quote this message in a reply
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
Find all posts by this user
Quote this message in a reply
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]
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: