Java program to split a comma-separated string


Program

//Program to Comma separated word from a String
public class CommaSeparated
{
public static void main(String[] args)
{
String input="Welcome,to,Java Session Session Session"; //Input String
String[] words=input.split(",");//Separating the word using delimiter Comma and stored in an array
for(int k=0;k<words.length;k++)
{

System.out.println(words[k]);//Displaying the separated String

}
}

}

Output

Welcome

to

Java Session Session Session



Related Post

Comments


©candidjava.com