main()?
One of hundreds of answers available with our premium content service.
A: To overload the main() method you would have the same public visibility modifier, static method type, void return type and main method name but the type or number of arguments must vary.
Overloaded methods can provide versatility in a class and group similar behaviour with a common name. You may want to chain the standard main() method with an overloaded version that takes a conditional variable, key value or reference to signal further processing. This approach breaks down the program logic and indicates the overloaded main() method is associated with the standard version. The example below passes the original String[] arguments to an overloaded main(String[], int) method where the int argument is a key value for further processing.
… full answer hidden
Premium members click below for full answer
Can you give an example of overloading the main()?
Your premium content subscription is a single payment that gives you: