Write a method called vertical that accepts a string as its parameter and prints each letter of the string on separate lines. For example, a call of vertical("hey now") should produce the following output:
h
e
y
n
o
w
Program:
public class Ch03Ex12
{
public static void main(String[] args)
{
vertical("hey now");
}
public static void vertical(String str)
{
for(int i = 0; i < str.length(); i++)
{
System.out.println(str.charAt(i));
}
}
}
Output:
h
e
y
n
o
w