About Question enthuware.ocpjp.v7.2.1417 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
renatumb
Posts: 47
Joined: Mon Apr 08, 2013 7:55 pm
Contact:

About Question enthuware.ocpjp.v7.2.1417 :

Post by renatumb »

Why does it return
12 ""
Because the last letter is "l" so when it returns
11 ""
there is no anything else to return

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1417 :

Post by admin »

That's a good question and I am not really sure why :o
The javadoc says, the start method returns the "start index of the previous match" and "The index of the first character matched".
My guess would be that it is trying to return the index of the boundary.
-Paul.

sir_Anduin@yahoo.de
Posts: 62
Joined: Fri Aug 07, 2015 2:16 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1417 :

Post by sir_Anduin@yahoo.de »

i dont understand, if it says:
find()
Attempts to find the next subsequence of the input sequence that matches the pattern.
why does it find anything after "wow"?

nothing after it matchers the pattern [wow]*

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1417 :

Post by admin »

That is indeed a mystery to me. It doesn't print anything in Java 8. But the answer is correct for Java 7.

-Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests