Search code examples
javamethodsprogram-entry-point

Multiple main methods in java package


I have a project in NetBeans where two different classes have public static void main(String[] args) methods. When I press F6, the first class' main is always invoked. Why not the second? When I'm trying to display arguments of args, it says that this array is empty.


Solution

  • In the project properties, in the Categories, choose Run. then there is a Main Class. Set your main class there