I have a Java code that should print nothing if no-element string is passed.Currently,my method is passing all tests but the one with no-element string.It gives me error.Code is below.Any suggestions are welcome.
public static void printLetters(String text)
{
System.out.print(text.charAt(0));
for(int i=1;i<text.length();i++)
{
System.out.print("-" + text.charAt(i));
}
System.out.println();
}