Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Typo error in OCAJP Java 8 Jeanne Boyarsky and Scott Selikoff study guide - page 109  RSS feed

 
Javid Azimli
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Method signature on the "boolean contains(String str)" should be replaced with "boolean contains(CharSequence s)"
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37037
504
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We actually did that on purpose. Since "CharSequence" isn't on the exam and the exam doesn't test passing a StringBuilder there, we provide a "simplified API."
 
Javid Azimli
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:We actually did that on purpose. Since "CharSequence" isn't on the exam and the exam doesn't test passing a StringBuilder there, we provide a "simplified API."


In my opinion, you should have illustrated real API and shoulda given some additional information about CharSequence.It may confuse readers that isn't real one and doesn't contain actual signature.
 
Charles O'Leary
Ranch Hand
Posts: 184
4
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javid,
A lot of folks (like myself), including many folks that achieved on the Certification Results forum, don't want to "waste time" on external material (... "Cliff Notes" please).  That was the sole reason that I (and maybe others) purchased the "Study Guide". 

I imagine that a lot goes into authoring and making decisions about what is and/or what isn't relevant to the exact specifics for a particular book (or chapter or section or paragraph or sentence or fragment of code).

As you alluded, the API is always (freely) available.  I imagine that the publishers may need to charge us more for more pages if they have to write/include/mention everything that we all individually want to satisfy us all.         
 
João Victor Gomes
Ranch Hand
Posts: 110
11
Eclipse IDE Java Netbeans IDE Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that a Study Guide is just helping us with the content of the exam, and that's why I'm studying with other books too.
But in page 110, the replace() methods are presented in their two real forms, which are

So, here the CharSequence is being used, and it may lead someone to think that "boolean contains(String str)" is an error of the book. Thus, following the authors' idea, maybe the replace() method should be presented as String replace(String, String).
 
Javid Azimli
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charles O'Leary wrote:Javid,
A lot of folks (like myself), including many folks that achieved on the Certification Results forum, don't want to "waste time" on external material (... "Cliff Notes" please).  That was the sole reason that I (and maybe others) purchased the "Study Guide". 

I imagine that a lot goes into authoring and making decisions about what is and/or what isn't relevant to the exact specifics for a particular book (or chapter or section or paragraph or sentence or fragment of code).

As you alluded, the API is always (freely) available.  I imagine that the publishers may need to charge us more for more pages if they have to write/include/mention everything that we all individually want to satisfy us all.         


I understand, but it is not fair to introduce signature of the method of the API in changed form.
 
João Victor Gomes
Ranch Hand
Posts: 110
11
Eclipse IDE Java Netbeans IDE Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I don't know what happened here, I clicked to edit my answer, and it posted a new one.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37037
504
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javid,
The nice thing about opinions is that there are so many of them .

In any case, it isn't a "typo" since what was printed is what we intended!
 
Roel De Nijs
Sheriff
Posts: 11295
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Since "CharSequence" isn't on the exam and the exam doesn't test passing a StringBuilder there, we provide a "simplified API."

How do you know that the exam doesn't test passing a StringBuilder to the contains() method? Because when you take the exam, you get only a subset of questions. Even if you questioned 100 exam takers about this, it's still not a 100% guarantee that no questions on this topic are on the exam.

And apparently the study guide mentions String replace(CharSequence oldChar, CharSequence newChar). That means (following the same logic) that one of the authors (or somebody they know) encountered an exam question testing a StringBuilder to the replace() method; otherwise a "simplified API" would be provided here as well.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37037
504
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We shouldn't have mentioned "String replace(CharSequence oldChar, CharSequence newChar)" - better?
 
Roel De Nijs
Sheriff
Posts: 11295
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have any issues with presenting a simplified API, but then I would expect that it's consistently applied throughout the whole study guide. Otherwise readers might get confused and have doubts why for one method a "simplified" version is used and for the other method its actual signature is used.

Personally I would not have simplified the CharSequence interface, although it's not on the exam. This interface is pretty straightforward and easy to explain (probably you don't need more than a one-liner, e.g. "an interface which represents (like its name suggests) a sequence of characters. Some of the most used classes within the Java API implement this interface like String and StringBuilder"). And with such an explanation you can use the actual signature of these methods and you don't have to doubt about simplifying or not.

 
Charles O'Leary
Ranch Hand
Posts: 184
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Personally I would not have simplified the CharSequence interface, although it's not on the exam. This interface is pretty straightforward and easy to explain (probably you don't need more than a one-liner, e.g. "an interface which represents (like its name suggests) a sequence of characters. Some of the most used classes within the Java API implement this interface like String and StringBuilder"). And with such an explanation you can use the actual signature of these methods and you don't have to doubt about simplifying or not.
CharSequence.png
[Thumbnail for CharSequence.png]
 
Charles O'Leary
Ranch Hand
Posts: 184
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(from page 110 Kindle)
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37037
504
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Point taken. We were inconsistent. It still isn't a typo .
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!