Java Reference
In-Depth Information
7. for(String value : values) {
8. if(pattern.matcher(value).matches()) {
9. counter++;
10. }
11. }
12. System.out.println(counter);
A.
0
B.
1
C.
2
D.
3
E.
4
24.
What is the result of the following code?
2. String s = “Good morning sunshine the earth says hello”;
3. Scanner in = new Scanner(s);
4. in.useDelimiter(“\\s[s]”);
5. int counter = 0;
6. while(in.hasNext()) {
7. in.next();
8. counter++;
9. }
10. System.out.println(counter);
A.
3
B.
4
C.
8
D.
9
E.
0
Search WWH ::
Custom Search