+ 1
Using charAt
I'm trying to use charAt to compare letters to see which comes first. I don't know how to move from charAt (0) > charAt (1) to charAt (2) > charAt (3) and so on.
3 Réponses
+ 12
for comparing char , U can use == operator
// String_value.charAt (index no.); is basic syntax
+ 2
use a for loop, and the counting variable as argument for charAt
+ 2
String s = "ABC";
for(int i = 0; i < s.length(); i++) {
System.out.println(s.charAt(i));
}