File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Overloading the methods with Object and String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Overloading the methods with Object and String" Watch "Overloading the methods with Object and String" New topic

Overloading the methods with Object and String

thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
When I ran the following code by passing null as a parameter ,which method will get executed and why does not it take null as parameter?If any other object passed what could be the possible result?
After running this code snippet,I got a error as given below: cannot resolve symbol
symbol : method aMethod1 (java.lang.Object)
location: class TestOverLoadinObject

class OverLoadinObject
void aMethod1(Object obj)
System.out.println("Here from object!!"+obj);}
void aMethod1(String str)
System.out.println("Here from String!!"+str );
public class TestOverLoadinObject

public static void main(String[] args)
TestOverLoadinObject objTestOverLoadinObject = new TestOverLoadinObject();
Object obj = null;
} :roll:
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Follow up here. Please stop posting duplicates of the same question in different places; it's more work for us to sort through them.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Overloading the methods with Object and String
It's not a secret anymore!