java - Why one can not call main method from another method -
main
method static, why 1 don't call method.
class main(){ public static void main(string[] args){ } public static void abc(){ main.main(string arr); } }
why 1 can not call main
method method.
you can call it, need pass string array :
public static void abc(){ main.main(new string[] {"something"}); }
or @ least empty array :
public static void abc(){ main.main(new string[0]); }
you should declare main
class (thanks chetan's comment):
public class main { public static void main(string[] args){ } ...
Comments
Post a Comment