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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -