CSS font stacks & developer FAQs with Web standards
Site navigation below

One of hundreds of answers available with our premium content service.

Part answer, see below for more

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

Click for full answers

Premium members click below for full answer
Can you give an example of overloading the main()?

Premium service benefits

Your premium content subscription is a single payment that gives you:

Home · Web fonts · Font stacks · FAQs · Java · CSS · Javascript · HTML · Site manager