Curriculum
Course: Java Basic
Login

Curriculum

Java Basic

Java Home

0/1

Java Introduction

0/1

Java Get Started

0/1

Java Syntax

0/1

Java Comments

0/1

Java Type Casting

0/1

Java Operators

0/1

Java Booleans

0/1

Java Switch

0/1

Java Break / Continue

0/1

Java Errors and Exception

0/1
Text lesson

join()

Example

Concatenate strings with a space separating each of them.

String fruits = String.join(" ", "Orange", "Apple", "Mango");
System.out.println(fruits);

Definition and Usage

The join() method combines one or more strings using a designated separator.

Syntax

One of the following:

public String join(CharSequence separator, CharSequence... elements)

 

public String join(CharSequence separator, Iterable elements)

Parameter Values

Parameter

Description

seperator

Mandatory. The delimiter utilized for joining the elements.

elements

Necessary. Elements that will be combined.

Technical Details

Returns

A fresh string, segmented by the provided separator.

Java Version

1.8