// Case 1 with using charAt()
String str = "Hai Navas";
for(int i=0;i<str.lenght();i++){
char c = str.charAt(i);
System.out.println("Character"+i+":"+c);
}
// Case 2 without using charAt()
String str = "Hai Navas";
for(char c: str.toCharArray())
System.out.println(c);
String str = "Hai Navas";
for(int i=0;i<str.lenght();i++){
char c = str.charAt(i);
System.out.println("Character"+i+":"+c);
}
// Case 2 without using charAt()
String str = "Hai Navas";
for(char c: str.toCharArray())
System.out.println(c);