Split String into Array using Java

split method

package app;

public class Main
{
    public static void main(String[] args)
    {
        String text = "First,Second,Third";
        String[] data = text.split(",");

        System.out.println(data[0] + " " + data[1] + " " + data[2]);
    }
}

Leave a Comment

Cancel reply

Your email address will not be published.