Question:

What is advantage of overloading main method?

by  |  earlier

0 LIKES UnLike

 Tags:

   Report

3 ANSWERS


  1. can u override main method?


  2. Can u overload main method.
    what is advantage of overloading main method?

  3. Method Overloading provides cleanliness of code.
    for ex:if you want to write a Java  program that consists of methods where each method operates on different types of data, then you use a unique name for each method in order to differentiate them. but this makes your program very complex and somtimes you get confused about which method is to be invoked for a particular operation.
    but by using method overloading,you can have many methods with same name, but with different formal arguement lists and definations and a decision about invoking a method is made at compile time by examining the number,datatype and order of parameters to check that whether they match with the actual arguement list being passed to a method.
    The programmer need not worry about which method is going to be invoked during at run time as its decision is made at compile time and the program becomes simple to be understood. this is the advantage of usin Method Overloading.

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.