Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

main method

 
jai gurudev
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

is it possible to call main() from another method,give some example

regards

jaigurudev
 
Petr Blahos
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is possible.

P.
 
Kj Reddy
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess MMM() method should be declared as static.

Regards
Jagdish
 
subhit chauhan
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MMM() is a constructor !!!
 
iyappan sankaran
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,we can.

class sample
{
static
{
call();
}
public static void call()
{
main(new String[]{"hello","world"});
}
public static void main(String args[])
{
System.out.println(args[0]);
System.out.println(args[1]);
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic