Java- Method Signature / Chapter -5 / OOP's Concept



   Java- Method SignatureJava Method Signature



    1. In Java method signature consists of, methods names followed by arguments types.

Method Signature Syntax

     2. Return Type is not part of the method signature in java.
     3.The compiler will use method signature to resolve method calls.

example:-


class Test
{
        public void m1(int i)
       {
             System.out.println(int  type arguments");
         }   
        public void m1(String s)
       {
             System.out.println(String type  arguments");
         }   
        public static void main(String [ ] args )

        {

               Test   t    =new  Test( );

               t.m1(10);

               t.m1("javabychetan");

        }

}

 


Output
 int type arguments 

 String type arguments

              

4.In a class two method with the same signature not allowed, If we are trying to do so then we will get compile time error.

 

example:-

Java- Method Signature

No comments:

Post a Comment

Be the first to comment!

Don't just read and walk away, Your Feedback Is Always Appreciated. I will try to reply to your queries as soon as time allows.

Note:
1. If your question is unrelated to this article, please use our Facebook Page.
2. Please always make use of your name in the comment box instead of anonymous so that i can respond to you through your name and don't make use of Names such as "Admin" or "ADMIN" if you want your Comment to be published.

Regards,
JavaByChetan
Back To Home

Flipkart End Of Season Sale






© Copyright 2017 Javabychetan.blogspot.com