3

Could anyone answer me the output and the logic behind its implementation?

Comments
  • 8
    Method Overloading, Google that.
    This is no place for this kind of questions tho'.
  • 7
    @c3r38r170 I don’t see why not. We’re a friendlier bunch than SO.
  • 9
    @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/...
  • 3
    @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?
  • 4
    @AmyShackles
    Exactly. If you're obliging us to write paragraphs of explanation, reciprocity is encouraged.
  • 3
    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.
  • 1
    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.
  • 1
    @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.
  • 1
    @c3r38r170 Let the hommie breath.

    Here is a safe space.
Add Comment