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

Duplicate Method Compiler Error

 
abin joy
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
code
---------------------------------

class Test
{
public static void render(Shape s, Circle c)
{
System.out.println("render(Shape s, Circle c)");
}

public static void render(Circle c, Shape s)
{
System.out.println("render(Circle c, Shape s)");
}
}

----------------------------------
code

I expect this code to throw a duplicate method found compilation error?But its not throwing?I removed the arguments to both the functions and it immediatrely throws compiler error.Can anybody help me in this
[ September 10, 2008: Message edited by: abin joy ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... because the methods have different argument lists? The order in which the arguments appear matters (of course).
 
Brij Garg
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an example of function overloading.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic