• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you call "Static Void Main ( String [] args )?

 
John Quach
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know Static methods can be accessed by any class.... but I can't wrap my head around this.



This method appears usually on a client class. Can it be called?
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes... use [Classname].man(). Did you make a typo? Should it be main() instead? Why are you worrying about only this static method? Aren't you seeing this method called anywhere in the code?
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read - The Main Method
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main method is just a method, exactly the same as any other method - there's nothing "magical" about it. You can call it just like you would call any other static method:

 
Campbell Ritchie
Sheriff
Pie
Posts: 49361
62
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote: . . . You can call it just like you would call any other static method:
And here is a different version of Jesper’s example:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic