File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes method invocation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "method invocation" Watch "method invocation" New topic

method invocation

payal bansal

Joined: May 01, 2001
Posts: 23
When i run this program, o/p is String Version. Could anyone give me the reason for this? Why Object version not get printed. I do want to know the reason for this o/p. Please help me!
1. public class Test {
2. public void method(Object o) {
3. System.out.println("Object Version");
4. }
5. public void method(String s) {
6. System.out.println("String Version");
7. }
8. public static void main(String args[]) {
9. Test test = new Test();
10. test.method(null);
11. }
12. }
Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241
Hi, Payal.
Have a look at these two links:
I agree. Here's the link:
subject: method invocation
It's not a secret anymore!