• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Errata for OCA/OCP Java SE 7 Programmer I & II Study Guide (K&B7)

 
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 9, page 521
In the "tricky example", creation of paths 1,2 and 4 fails with "java.nio.file.InvalidPathException: Illegal char <*> at index..." on Windows. Works correctly on Unix
The example actually seems to already prompt a SO question as well: http://stackoverflow.com/questions/27522581/asterisks-in-java-path
Perhaps this should be emphasized, as with the dir boundaries on the previous page
 
J Deckarm
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter11, page 611-612
If the collection/array you want to search was sorted using a Comparator, it must be searched using the same Comparator, which is passed as the second argument to the binarySearch() method
=> It seems to be actually the third argument: static <T> int binarySearch(T[] a, T key, Comparator<? super T> c)
 
J Deckarm
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 11, page 618
"which produces something like this:
Dog@1c
..."
=> since we are getting the Dog instance with the name "aiko" here, and the hashcode is name.length(), this output seems to be Dog@4
 
J Deckarm
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 11, page 581
"You must also be able to recognize an appropriate or correct implementation of hashCode(). This does not mean legal and does not even mean efficient."
=>
The usage of the terms "appopriate/correct" and "legal" seems to have already generated some discussions in the past, see e.g. this thread
https://coderanch.com/t/426597/java-programmer-SCJP/certification/Clarification-needed-legal-hashCode-implementations
From here it seems that the terms cover the followings
- legal: valid, compilable java code
- appropriate/correct: fulfills contract
In light of this the above phrasing would suggest that an appropriate/correct (i.e. contract fulfilling) implementation could be still illegal (i.e. not compilable) which does not seem to make sense
 
Ranch Hand
Posts: 33
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 3, page 175, on the last line of the Exam Watch:

It says that the following is not legal:
int x, y=x+1, z; // illegal: x is not initialized before y uses it

This is true for local variables, but not for instance variables.
However, neither in the Exam Watch nor in the preceding text it is mentioned or even implied that it is about local variables and not about instance variables. So a note about this should be added.

[edit] This topic has a discussion (and more detailed information) about this errata item
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rijk van de Scheur wrote:Chapter 14, page 810.

I found no executor() method in the API documentation. I suppose this must be


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rijk van de Scheur wrote:Chapter 15, page 874: getTime method

and has to be:


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

a hasver wrote:page 929 (CERTIFICATION SUMMARY JDBC)

"...added to the Connection object (the Connection.createConnection(int,int) method...." should be Connection.createStatement(int,int)


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:chapter 12, self-test 8
code line numbers seem to be irrelevant here, no response uses them


Thanks for the suggestion! But that's not an errata item. On the exam you'll encounter many code snippets with line numbers without the answer options refering to the line numbers.

Kind regards,
Roel
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Don Fredricks,

First of all, a warm welcome to CodeRanch!

Don Fredricks wrote:The Two-Minute Drill at the end of Chapter 6 (page 361) contains the following statement:

"The default block can be located anywhere in the switch block, so if no preceding case matches, the default block will be entered, ..."

I suggest that the word "preceding" is not quite correct; if no other case matches, the default block will be entered.


Added to the errata overview.

Kind regards,
Roel
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henno Vermeulen wrote:OCA Mock Exam Question 41.
According to the answers, the statement "Encapsulation makes it easier to reuse classes" should be true.
I think this is not immediately obvious and is debatable, so I would lean to not true.


Thanks for the suggestion! But as discussed in the thread you created about this topic, encapsulation makes it easier to reuse classes. Therefore this issue is not added to the errata overview.

Kind regards,
Roel
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jefferson Madalena,

First of all, a warm welcome to CodeRanch!

Jefferson Madalena wrote:on chapter 3, page 175, in exam watch notes

To be:
int j, k=m+3, l, m=1; // illegal: m is not declared and initialized before k uses it


Thanks for reporting this errata item! Added to the errata overview.

Kind regards,
Roel
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henno Vermeulen wrote:The diagram on page 494 claims that the (java.nio.file.)Files class uses the Paths class. This is not correct. It uses the Path interface!


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henno Vermeulen wrote:On page 504 they say about this:



So Java actually does not give nonsense but does the only right thing to do here. For all it knows the Path referred to by "Model.pdf" may be a directory and the Path referred to by "dir" may be a file!


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

C Selberg wrote:Chapter 10 page 552
Correct:
If getInstance() weren't public, we would still have a singleton. However, it wouldn't be as useful because only static methods of the package would be able to use the singleton.


As mentioned in this topic, that statement is incorrect as well. Because instance methods can access static methods without any problem. So every method (instance or static) in the same package will be able to access the getInstance() method.

Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:chapter 8, page 458
We can call getObject() to get a non-String value:
Locale locale = new Locale(args[0], "CA");
=> args[0] doesn't seem to make much sense here, from the example context it should be likely "en" instead


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:Chapter 9, page 521
In the "tricky example", creation of paths 1,2 and 4 fails with "java.nio.file.InvalidPathException: Illegal char <*> at index..." on Windows. Works correctly on Unix


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:Chapter11, page 611-612
If the collection/array you want to search was sorted using a Comparator, it must be searched using the same Comparator, which is passed as the second argument to the binarySearch() method
=> It seems to be actually the third argument: static <T> int binarySearch(T[] a, T key, Comparator<? super T> c)


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:Chapter 11, page 618
"which produces something like this:
Dog@1c
..."
=> since we are getting the Dog instance with the name "aiko" here, and the hashcode is name.length(), this output seems to be Dog@4


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:Chapter 11, page 581
"You must also be able to recognize an appropriate or correct implementation of hashCode(). This does not mean legal and does not even mean efficient."


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roger Jenkins wrote:Chapter 3, page 175, on the last line of the Exam Watch:

It says that the following is not legal:
int x, y=x+1, z; // illegal: x is not initialized before y uses it


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It took me a while longer as usual, but I was very busy the past few months, had a holiday and we had the OCAJP8 study guide book promotion as well.

But I can now let you all know (with some pride ): the errata overview is up-to-date again, all new reported errata (14) were added.

Thanks for reporting all these errata items!

Happy studying!
 
J Deckarm
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chapter 14, page 804
Here is a demonstration of queue add/remove methods using a LinkedTransferQueue object tq. But LinkedTransferQueue itself is unbounded, so "if bounded", "if full" etc. comments beside tq.add(), tq.put() etc methods seem to be confusing
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:chapter 14, page 804
Here is a demonstration of queue add/remove methods using a LinkedTransferQueue object tq. But LinkedTransferQueue itself is unbounded, so "if bounded", "if full" etc. comments beside tq.add(), tq.put() etc methods seem to be confusing


During technical reviewing of the book I made the same comments about this code snippet, but for some reason my suggestion was applied. Probably because the preceding text clearly states LinkedTransferQueue is an unbounded queue and the code snippet should demonstrate all different queue methods.

Added to the errata overview.
 
J Deckarm
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chapter 15, page 901
public String getMessage() states: "But this method returns the detailed reason why the exception was thrown. Note that this is not the same message that is returned from the toString() method, i.e., the method called when you put the exception object instance into a System.out.println method"
=> for me the only difference seems to be that the exc.toString() printout starts with "java.sql.SQLException: ", but then the error text itself is the same as that of exc.getMessage()
 
J Deckarm
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chapter 15, page 905
"A resource declared in the try-with-resource statement must implement the AutoCloseable interface. ...Connection, Statement, and ResultSet all implement the AutoCloseable interface"
=> Two remarks on this
(1) As much as I know it is also OK if the resource implements the Closeable interface which extends AutoCloseable
(2) Connection, Statement, and ResultSet are interfaces themselves therefore they seem to be in fact extending the AutoCloseable interface
 
J Deckarm
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chapter 15, page 907
"Unlike prepared statements, stored procedures and functions must exist before a CallableStatement can be executed on them."
=> This sentence seems to be somewhat confusing; sounds as if CallableStatement would execute PreparedStatement as well
 
J Deckarm
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chapter 15, page 923
"A transaction includes all of the SQL queries you execute until either..."
=> While it might be a terminology debate, "queries" could seem to indicate SELECTs only.

Actually on page 924 the same concept is phrased as
"A flat transaction can include a number of different SQL statements,..."
which seems to be more appropriate
 
J Deckarm
Ranch Hand
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chapter 14, page 818
"A ForkJoinTask has many methods (most of which you will never use), but the following methods are important: compute(), fork(), and join()"
=> This might be somewhat misleading, because the compute() methods are in fact not in the ForkJoinTask class itself, but its subclasses RecursiveTask and RecursiveAction
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:chapter 15, page 901
public String getMessage() states: "But this method returns the detailed reason why the exception was thrown. Note that this is not the same message that is returned from the toString() method, i.e., the method called when you put the exception object instance into a System.out.println method"
=> for me the only difference seems to be that the exc.toString() printout starts with "java.sql.SQLException: ", but then the error text itself is the same as that of exc.getMessage()


Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

J Deckarm wrote:chapter 15, page 905
"A resource declared in the try-with-resource statement must implement the AutoCloseable interface. ...Connection, Statement, and ResultSet all implement the AutoCloseable interface"
=> Two remarks on this
(1) As much as I know it is also OK if the resource implements the Closeable interface which extends AutoCloseable


The only condition for a resource to be used in a try-with-resources statement: it must implement the AutoCloseable interface. It doesn't matter if it's directly or indirectly through another class or interface; if the resource IS-A AutoCloseable, it can be used in a try-with-resources statement. Because java.io.Closeable extends from AutoCloseable, all objects which implement java.io.Closeable can be used as a resource.

J Deckarm wrote:(2) Connection, Statement, and ResultSet are interfaces themselves therefore they seem to be in fact extending the AutoCloseable interface


Added to the errata overview.
 
reply
    Bookmark Topic Watch Topic
  • New Topic