+ 1

How to print a string's letters using for loop in java as like in python?

Eg : for i in "HELLO" Print(i) O/p: H E L L O

3rd Oct 2022, 12:40 PM
Venkatesh
Venkatesh - avatar
3 Answers
3rd Oct 2022, 2:23 PM
Ipang
+ 1
String s = "hello"; for (int i=0;i<s.length;i++) System.out.print(s.charAt(i)+" ");
3rd Oct 2022, 3:16 PM
Random
Random - avatar