The
join() method of
Floats Class in the Guava library is used to combine or join all the given float values separated by a
separator. These float values are passed a parameter to this method. This method also takes the separator as the parameter. This method returns a String which is the result of join operation on the specified float values.
For example: join("-", 1L, 2L, 3L) returns the string "1-2-3".
Syntax:
public static String join(String separator, float... array)
Parameters: This method accepts two mandatory parameters:
- separator: which is the floatacter that occurs in between the joined float values.
- array: which is an array of float values that are to be joined.
Return Value: This method returns a string containing all the given float values separated by
separator.
Below programs illustrate the use of this method:
Example 1:
Output:
2.3#4.2#6.2#8.6#10.5
Example 2: