how to get the characters one by one from a String?
I'm a newbie, I was learning the "String" & got stuck on a question i.e how to get the characters one by one from a String?
Actually I had a program the will take one sentence from the user. That will give a output-
The no of consonants, vowels, digits on that line.
I went on like this...
code:
import java.util.*;
class TestSentence{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
System.out.println("Enter any Sentence...:");
String s1=s.nextLine();
//
...
}
now I've that String...but can't read one by one characters from that as we can do from the array by their index....
So, if you tell me how to do this I'll be grateful to you.........