publicclassSplitExample2{
publicstaticvoidmain(String args[])
{
String str = "My name is Chaitanya";
//regular expression is a whitespace here String[] arr = str.split(" ");
for (String s : arr)
System.out.println(s);
}
}
// Java program to demonstrate working of split(regex, // limit) with small limit. publicclassGFG{
publicstaticvoidmain(String args[])
{
String str = "geekss@for@geekss";
String[] arrOfStr = str.split("@", 2);
for (String a : arrOfStr)
System.out.println(a);
}
}