Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Method Overloading, Google that.
This is no place for this kind of questions tho'. -
@AmyShackles
We're helpful, but we also have a bar. Asking for the answers to homework is below the bar. At best, answering questions like this* is enabling, at worst, it's contributing to the noted problems India has with academic plagiarism which is the result of a system which encourages this sort of proxy completionist approach to education**.
*They don't define what their confusion is, what effort they've already made in solving or understanding the problem themselves.
**https://ncbi.nlm.nih.gov/pmc/...
**https://sciencemag.org/news/2018/... -
@SortOfTested So it’s less that this isn’t the place to ask the question and more that more effort should have been put into the asking of the question to provide context and establish steps taken to attempt a solution in order to narrow down the focus?
-
@AmyShackles
Exactly. If you're obliging us to write paragraphs of explanation, reciprocity is encouraged. -
Wrong platform but...I'll be nice today.
There's two method signatures that have the same name.
One takes 1 param while the other takes 3.
Java infers which one to use by the number of arguments supplied.
It's called Method Overloading.
Furthermore, do not declare your main method as ...(String... args)
Standard is ...(String[] args)
String... is varargs. -
hello, guys, it was not my assignment or task, I just saw this image on the internet and after running the code I found a weird output, which I couldn't understand, so that's why I asked for help.
-
@akash250799 It's ok!
By the way, Method Overloading also takes types into accounts, so
method(String arg)
and
method(int arg)
will both work, but which one will be called will depend on the type of the argument you use.
Related Rants
Could anyone answer me the output and the logic behind its implementation?
question
java