class Volatile {
public static void main(
String [] args) {
String s = "x1234 y56 z7 a";
String [] sa = s.split("\\d");
int count = 0;
for( String x : sa)
count++;
System.out.println("total: " + count);
}
}
What's result?
A) total: 7
B) total: 8
C) Compile error because "volatile" is a keyword
Why is answer B? Why does count not reflect # of tokens?
[ May 30, 2006: Message edited by: Firas Zureikat ]
[ May 30, 2006: Message edited by: Firas Zureikat ]