I am passing an object of class "String" to hello function and i want to pribt all the chars so i am using foreach loop

My main motive is to use foreach so please help me to type cast it

follwoing is the code i have

int i=0 ;
public void hello( String st)
{

for(int i:collection((String) st))
{
System.out.println(st.charAt(i));
i++;
}