Alexander Weickmann wrote:Mock Test - 1 Question 83. seems to be wrong. It's OK to define a finally block when using try-with-resources but the book says this is not allowed.
Certifications: OCPJP 7 and OCPJP 8 [OCPJP 8 Book] [OCP8 Exam Resources] [OCPJP 7 Book]
Tyson Lindner wrote:To authors:
Do you think you could create a sorted list of errata from the first print edition? It would be much easier to correct. Also some of the posts on the errata message board weren't addressed so I'm not sure if they're correct or not.
Tushar Sharma (Twitter: @Sharma__Tushar)
http://www.tusharma.in
http://designsmells.com/
Devaney Marcondes wrote:In my opinion the question 5 of the chapter 7 have 2 correct answer.
The B and C are correct.
Devaney Marcondes wrote:
I will correct myself but the book answer is still incorrect.
The correct answer is C.
The book explanation say:
Answer: B. “b\ D\ w*@\ w +\. com\ b” (“\ b” is used to mark word boundaries,
“\ D” is used to match any non-digit number, and “\ w*”
is used to match any word of length zero or more.
The remaining part is similar to that used earlier.)
For this reason \w* is wrong because if the email is "@notaemail.com" the regex “b\ D\ w*@\ w+\. com\ b” will accept it.
The right regex is “b\ D\w+@\ w +\. com\ b” (with the plus before @).
Tushar Sharma (Twitter: @Sharma__Tushar)
http://www.tusharma.in
http://designsmells.com/
T. Sharma wrote:
Devaney Marcondes wrote:
I will correct myself but the book answer is still incorrect.
The correct answer is C.
The book explanation say:
Answer: B. “b\ D\ w*@\ w +\. com\ b” (“\ b” is used to mark word boundaries,
“\ D” is used to match any non-digit number, and “\ w*”
is used to match any word of length zero or more.
The remaining part is similar to that used earlier.)
For this reason \w* is wrong because if the email is "@notaemail.com" the regex “b\ D\ w*@\ w+\. com\ b” will accept it.
The right regex is “b\ D\w+@\ w +\. com\ b” (with the plus before @).
Dear Devanev, with due respect I think your explanation is not correct. You are missing "\D" which is used in this question to satisfy the requirement of the question that the email address must not start with a digit. Thus, the regex will not match to "@notaemail.com" because the regex looks for a not digit (due to "\D") which is missing. Since, "\D" is already used, there should be "\w*" (and not "\w+") to make the expression correct; otherwise it will not match to addresses like "[email protected]". I hope it will help.
You are right about the typo, we will include that in our errata doc. Thanks for that.
Tushar Sharma (Twitter: @Sharma__Tushar)
http://www.tusharma.in
http://designsmells.com/
Tushar Sharma (Twitter: @Sharma__Tushar)
http://www.tusharma.in
http://designsmells.com/
Tushar Sharma (Twitter: @Sharma__Tushar)
http://www.tusharma.in
http://designsmells.com/
T. Sharma wrote:Thanks Devaney and Sergey for sharing possible mistakes.
@Sergey: Here is the full description given for the question 3 in the book; partial text may confuse other readers.
"The Integer objects are immutable objects. If there is an Integer object for a value that already exists, then it
does not create a new object again (only if the value of the Integer is between -128 and 127 (inclusive)). In other
words, Java uses sharing of immutable Integer objects, so two Integer objects are equal if their values are equal
(no matter if you use == operators to compare the references or use equals() method to compare the contents)."
Sergey Korytnikov wrote:
T. Sharma thank you for your response. I'm not trying to confuse any readers. I ordered my book on Amazon 1+ month ago in advance, before I took OCA exam and opened your book yesterday first time.
In my hard copy I don't see that "(only if the value of the Integer is between -128 and 127 (inclusive))" - that's why I raised the question. Where did you find it? Which page?
You mentioned that you've fixed ebooks, what is hard to do with released paper book.
It's pretty confusing that I can't use ordered book without double checking all errors with forums and websites as I'm not going to spend more money for ebook.
Do you have any thoughts to provide fixed ebooks free to those who ordered hard copies?
Tushar Sharma (Twitter: @Sharma__Tushar)
http://www.tusharma.in
http://designsmells.com/