Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Stewart
1,179 PointsDoes the main method have to be static?
Also, if the main method is static, does that mean that there is a possibility that there could be multiple Example classes?
1 Answer
Brendon Butler
4,254 PointsThe main method has to be static because it's called by the JVM (Java Virtual Machine) at runtime.
You would be able to have multiple "Example" classes, as long as they were in different packages (folders).
You can have more than one main
methods. However, they have to take different parameters (see here).