I have a doubt about Java.
In a Java project (handled by Eclipse for example), can I have more classes that contain the main() method and consequently can I chose to execute one class or another class?
Tnx
Andrea
Yes, you can have more classes that contain the main() method, but at least one class which contain main() should be public so that JMV will start that class as Main thread
You can have as many Classes as you want as long as each class have single main
method.
You'll have to be opening a Specific Class in Eclipse if you wanna run main
in that class or you can choose previously run classes from Eclipse Run
Menuitem.
main
means public static void main(String[] args)
which is entry point in java programs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With