How to Iterate a String in Java

package pretechtest;
public class StringTest {
	public static void main(String[] args) {
		String str = "Hello pretech";
		for (int i = 0; i <= str.length()-1; i++) {
			System.out.println(str.charAt(i));
		}
	}
}

Output



H
e
l
l
o
p
r
e
t
e
c
h


No comments:

Post a Comment

Confusion Matrix + Precision/Recall (Super Simple, With Examples)

  Confusion Matrix + Precision/Recall (Super Simple, With Examples) 1) Binary Classification Setup Binary classification means the model p...

Featured Posts