Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • How to Overload main() method ?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 329
    Comment on it

    Overloading Method:

    Overloading Method can be easily defined by having multiple methods with same name but with different parameter, in a Class. Difference in Parameter can be in number of parameters used in method or change in type of parameter.

    For Example:

        class Area{  
          void area(int length,int breadth)
          {
        	  System.out.println(length*breadth);
          }  
          void area(double radius)
          {
        	  System.out.println(3.14*radius*radius);
          }  
          }

    But How to overload main():

    class Demo
      {  
      public static void main(int a)
      {  
      System.out.println(a);  
      }  
      public static void main(String args[])
      {  
      System.out.println("Overloading main() method");  
      main(50);  
      }  
    } 

    Output we Obtain is :

    Overloading main() method
    50
    

     

    overloading main method main method main() Java

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: