String toCharArray() Example Program

package com.practice.string;

public class StringToCharArrayExample{

public static void main(String args[]) {
String s1 = "Basic Programs";
char[] ch = s1.toCharArray();
for (int i = 0; i < ch.length; i++) {
System.out.print("\n"+ch[i]);
}
}
}


Output :


B
a
s
i
c
 
P
r
o
g
r
a
m
s

Comments

Popular Posts