Forum Stats

  • 3,826,761 Users
  • 2,260,705 Discussions
  • 7,897,072 Comments

Discussions

public static void main(String[] args)

2653132
2653132 Member Posts: 1
edited Apr 12, 2014 12:57AM in Java 8 Questions

In java Every method must be enclosed in Class...Then

public static void main(String[] args)

{

}

belongs to which class..????

Answers

  • wizzle2
    wizzle2 Member Posts: 11

    You can put it in whatever toplevel class you like.

    You can even have many different main methods if you put each in a different class. In this way you can have many alternate entry points to your program if you wish.

This discussion has been closed.