Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Angjelin Malaj
5,983 PointsWrite a program that prints out Hello vertically! Dont use \n or multiple. Use loops style. Smb can help me please?
Its an assignment for me and i am getting confused
2 Answers

Stephen Shine
5,991 PointsUsing a for loop is a classic way of looping through an array. And remember that strings are an array of characters.
There's a useful function in Java to convert a string to an array of characters. You could then use the println method as part of the System class. Something like this:
String text = "Hello";
char[] textArray = text.toCharArray();
for (int i = 0; i < textArray.length; i++) {
System.out.println(textArray[i]);
}

Angjelin Malaj
5,983 PointsThank you Stephen Shine! it worked perfectly well