English

Differentiate between main() method and other methods.

Advertisements
Advertisements

Question

Differentiate between main() method and other methods.

Distinguish Between
Advertisements

Solution

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
  Is there an error in this question or solution?
Chapter 3: User-Defined Methods - Exercises [Page 91]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 3 User-Defined Methods
Exercises | Q 4. (v) | Page 91
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×