Does anyone have a fix for this for loop problem using char? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Does anyone have a fix for this for loop problem using char?

I'm trying to loop these 2 symbols "/_" and keep getting a playground error 😳 https://code.sololearn.com/cCq7MwFacw8n/?ref=app

8th Sep 2017, 12:05 PM
D_Stark
D_Stark - avatar
2 Answers
+ 4
public class Program { public static void main(String[] args) { String s; s = new String("/_"); char c = s.charAt(0); char ch = s.charAt(1); for(int i = 0; i<10; ++i){ System.out.println(c); // You wrote print System.out.println(ch); // You wrote print } } }
8th Sep 2017, 12:11 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 1
thanks but its not what i want i need it on the same line using "print"
8th Sep 2017, 12:14 PM
D_Stark
D_Stark - avatar