What will be the output of the following program?
public class SplitStringByUsingDelimiter
{
public static void main(String args[])
{
String str = "Ram-Robert-Rahim";
String[] temp;
String delimiter = "-";
temp = str.split(delimiter);
for(int i = 0; i < temp.length ; i++)
{
System.out.print(temp[i] + " ");
str = "Ram.Robert.Rahim";
delimiter = "\\.";
temp = str.split(delimiter);
}
System.out.println();
for(int i = 0; i < temp.length ; i++)
{
System.out.print(temp[i] + " ");
temp = str.split(delimiter, 2);
System.out.println();
for(int j = 0; j < temp.length ; j++)
{
System.out.print(temp[i] + " ");
}
System.out.println();
}
}
}