Advertisements
Advertisements
प्रश्न
Differentiate between main() method and other methods.
फरक स्पष्ट करा
Advertisements
उत्तर
| Feature | Main() Method | Other Methods |
| Purpose | Acts as the starting point of program execution. | Performs specific, reusable tasks or calculations. |
| Invocation | Called automatically by the system runtime (JVM/CLR). | Must be called explicitly by the programmer. |
| Naming | Name must strictly be main (case-sensitive). | Can have any valid user-defined name. |
| Quantity | Only one primary main method per executable application. | A program can have an unlimited number of methods. |
| Signature | Requires a strict predefined signature (e.g., public static void main(String[] args) | Signature is flexible and defined by the developer. |
| Return Type | Usually void or int depending on the language. | Can return any valid data type or no value (void). |
| Arguments | Accepts a specific array of command-line strings. | Can accept any number, type, or no arguments at all. |
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
