function signature

The Math.min function, which returns the minimum number of two, takes 2 parameters. If you call Math.min without parameters, Java will display the following: no suitable method found for Math.min(no arguments). We are told that such a function Math.min without parameters does not exist.

How do we know how many parameters need the Math.min function and what type of value does it return? We looked at the signature of this function. The signature determines the input parameters and their types, also the output parameter and its type. You can read about the function Math.min in official Java documentation.

You can pass parameters only in the sequence in which they are defined in the signature.

Any function always returns only one value (unless the type of the result is void, then it returns nothing). At the same time, the return value can be of a complex type and represent, for example, a list of some values.

instructions

In Java, the String class has a function concat. Examine its signature at java.lang.String.

Write a program that uses the concat function with the text variable and displays the result on the screen.


If you got stuck and don't know what to do, you can ask a question in our huge and friendly community
Exercise available only for signed users.

Please sign in with your GitHub account, this is necessary to track the progress of the lessons. If you do not have an account yet, now is the time to create an account on GitHub.