Hi Ranchers!
I've got some problems with understanding the following example from
ExamLab 1 practice exam. Question no. 60:
The target is to print ">
Java<" on the screen after execution of the code. One of the possible answers is this:
I've checked it, and it really doesn't print ">Java<" but ">Jav<" (it 'ate' the last letter - a).
Please, point me where am I making a mistake. I thought that this
pattern will search for at least one
word (
[\\w+] following by a whitespace character (
[\\s]) or digit (
[\\d]).
So I thought it will work like this:
Certificate
on
Java2
(...)
because:
"Certificate " fits [\\w+][\\s]
"on " fits [\\w+][\\s]
"Java2" fits [\\w+][\\d]
so can anyone explain me why does this pattern 'eats' the last letters and it spits out the
Certificat
o
Jav
?
Thanks in advance!