• Post Reply Bookmark Topic Watch Topic
  • New Topic

Overloading methods  RSS feed

 
Brian Jones Jr.
Ranch Hand
Posts: 39
2
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was reviewing the nuances of overloading methods, and I came across the paragraph in the Oracle docs:

The Java programming language supports overloading methods, and Java can distinguish between methods with different method signatures. This means that methods within a class can have the same name if they have different parameter lists (there are some qualifications to this that will be discussed in the lesson titled "Interfaces and Inheritance").


Last week I read the entire Oracle lesson on Interfaces and Inheritance Interfaces, and I don't remember reading about this. What are the qualifications?
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By no means an easy subject. I know that foo(int...) and foo(int[]) are regarded as equivalent to each other, so they are not permissible together. That sounds like a mistake in the Java™ Tutorials, so I shall send you to the Java® Language Specification (=JLS) here. Beware: The JLS is often difficult to read.
 
Brian Jones Jr.
Ranch Hand
Posts: 39
2
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:By no means an easy subject. I know that foo(int...) and foo(int[]) are regarded as equivalent to each other, so they are not permissible together. That sounds like a mistake in the Java™ Tutorials, so I shall send you to the Java® Language Specification (=JLS) here. Beware: The JLS is often difficult to read.


Thanks Ritchie!
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a pleasure
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!