File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

method invocation

 
payal bansal
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Payal.
Have a look at these two links:
http://www.javaranch.com/ubb/Forum24/HTML/006183.html
http://www.javaranch.com/ubb/Forum24/HTML/008498.html
Art
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic