• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can a main() method of class be invoked in another class  RSS feed

 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a main() method of class be invoked in another class, if yes, How? Please clarify in detail. Thanks
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why not?
 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would be syntax for that, as main is a static method, and If I would like to call it from another class, How can I do that. Please clarify.
Thanks
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You call it as you would call any other static method

 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for your clarification.
 
JigaR Parekh
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can execute main method because basically its a method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!