Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

Although I know the clear meaning of commonly used prepositions in English, sometimes, I'm a little confused with them and cannot understand the difference between them. A week or so ago, I asked a question on StackOverflow which was titled by me as follows.

In this simple question title, Java is a programming language as everybody knows, "Varargs" (abbreviated to variable arguments, specifically variable number of arguments) and "method overloading" are two concepts used in the Java programming language. Before I asked the question, I was not sure at all whether the question title should have been as it is mentioned above or it should have been modified as follows.

  • Varargs with method overloading in Java.

Which one is grammatically correct, both or none of them?

share|improve this question
2  
Not to be contrarian, but I would probably say "varargs and method overloading in Java." –  Robusto Oct 23 '12 at 14:50
    
Aren't the varargs part of the method overloading? If so, it would be in. –  Kris Oct 23 '12 at 15:08
    
I think your original is correct. 'with' would work in 'Method overloading with varargs in Java'. That said, the SO thread seems to describe Java's version of 'Rock, Paper, Scissors'. –  DaveP Oct 23 '12 at 15:27
    
This is not a question of grammaticality, but of meaning and usage. There are very few cases where substituting a preposition will change the grammaticality of a sentence. –  Colin Fine Oct 23 '12 at 22:18
add comment

1 Answer 1

up vote 1 down vote accepted

With means 'accompanied' or 'by'.

In means 'enclosed' or 'surrounded by'.

Method overloading is calling what appears to be the same function in a program but - because different arguments can be given to the function - it is technically a different method being called. This concept of multiple methods that are the same is known as method overloading.

Varargs is shorthand for 'variable arguments' and is a way of passing a set of arguments to a method without explicitly identifying each individual argument.

Putting it all together:

1) Method overloading can be performed by (using) varargs. So 'method overloading with varargs' is fine.

2) Varargs and method overloading as programming concepts accompany each other. You use different arguments for the same named function in overloading. You provide different arguments to a method with varargs. So 'varargs with method overloading' also works.

3) Method overloading does not need to involve varargs. You can overload a method that takes only one argument instead of a set for instance. These other implementations suggest that conceptually method overloading is larger than, and encompasses, varargs. So 'varargs in method overloading' is correct.

You should not say method overloading in varargs. They can't enclose each other.

I would suggest that all three of the above are perfectly valid. Of them perhaps 2) would generally be less used, but in the context of your question, is absolutely correct.

share|improve this answer
    
It makes a broad sense. Thank you. –  Tiny Oct 24 '12 at 21:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.