Results 1 to 2 of 2
  1. #1
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Method Overloading

    Java Code:
    public class Amb{
    
      public static void Method(String str){
        System.out.println("String");
      }
    
      public static void Method(Object o){
        System.out.println("Object");
      }
    
    public static void main(String[] args){
    
        Method(null); 
    }
    }
    why is the output of this code is String ?I thought it should be ambiguity, it can be passed to object too...
    Last edited by allaudin; 02-15-2014 at 10:06 PM.

  2. #2
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

Similar Threads

  1. overloading an equals method
    By tonmachine in forum New To Java
    Replies: 5
    Last Post: 03-17-2013, 02:26 AM
  2. What is use of method overloading and overriding
    By srinivasmallabathula in forum New To Java
    Replies: 3
    Last Post: 04-06-2011, 08:07 AM
  3. Method Overloading - Doubt
    By vidya lakshman in forum New To Java
    Replies: 4
    Last Post: 02-01-2011, 07:47 AM
  4. Method Overloading Verification
    By lala in forum New To Java
    Replies: 22
    Last Post: 11-30-2010, 06:32 AM
  5. Method/Operator Overloading
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-01-2007, 09:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •