• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Core Java, Volume II--Advanced Feature: Suitable for OCA/OCP exams?  RSS feed

 
Greenhorn
Posts: 5
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the book contain many subjects which cover objectives of the OCAJP/OCPJP exams? Is it suitable for or can it help to pass these exams?
 
author
Posts: 254
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, sorry, I am really not an expert on these exams. Googling led me to https://coderanch.com/t/656349/certification/Passed-OCAJP-OCPJP-month-days, where the poster recounts that the OCP exam has lots of questions on lambdas, streams, and the date/time API. The classic Core Java or the accelerated "Core Java for the Impatient" would be an excellent source to learn these subjects.
 
Marshal
Posts: 63461
207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree your books are excellent for learning those subjects, but there are a lot of things in cert exams not covered in your book. I can envisage this sort of thing for a simple cert exam question:-

What is the result of running the following code?

  • 1: Prints 0_000_000_012
  • 2: Prints 12
  • 3: Prints 10
  • 4: Prints 18
  • 5: Throws an exception
  • 6: Code won't compile
  • Or you can change the question slightly by adding an “x” immediately after the first 0.
     
    Cay Horstmann
    author
    Posts: 254
    28
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi, that's an excellent example.

    Of course, Core Java will tell you (1) You can put _ into number literals, and they are ignored. Do this to make long numbers more legible. (2) An integer literal starting with 0 is an octal number. This is a terrible feature and you should never do this.

    Those are two facts that every Java developer should know.

    Your sample shows the intellectual bancrupcy of so many certification questions. You can be a fine Java developer without ever knowing that octal 12 is decimal 10. This tidbit of trivia should not be tested. But you have to know it to answer this particular question. I have seen many questions that probe equally ephemeral esoterica about the switch statement, labeled breaks, thread groups, the behavior of Object.finalize, and so on.

    It would not be hard to change that question so that it tests that the test taker knows to stay away from accidental octals, without also having to learn how to compute their decimal values. But you can't rely on exam authors to do that kind of thinking, so you have to load up on a certain amount of trivia to pass the exam. For that, an exam cram book can be a good investment.

     
    Campbell Ritchie
    Marshal
    Posts: 63461
    207
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I presume octal literals are only there for backward compatibility.
    Have you tried it with the “x”? System.out.println(0x_000_000_012);? That sort of thing makes me wonder about the old buzzword “Simple”.
     
    Cay Horstmann
    author
    Posts: 254
    28
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Indeed, octal literals are there for backward compatibility. A rather cowardly decision even in 1995, if you ask me. JavaScript does better than that, outlawing them (in strict mode).

    I am somewhat more sympathetic to testing hexadecimal values, but still--that would be really, really low on my list of things that I want to require of every developer. And where does it stop? Floating point literals? Quick, boys and girls, what is  0x0.1p-3?

    Now look at this interview question that I just saw in this forum: https://coderanch.com/t/707443/java/Java-Interview That's a perfectly reasonable question. It tells you something about the candidate's ability to develop an algorithm, which seems a lot more important.



     
    Campbell Ritchie
    Marshal
    Posts: 63461
    207
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Cay Horstmann wrote:. . . what is  0x0.1p-3?  . . .

    I had to ask JShell. What I meant about “Simple” is that the code I showed earlier won't compile with the added “x”. Not unless I remove the first underscore, too.
     
    Roland Heinrich
    Greenhorn
    Posts: 5
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Campbell Ritchie wrote:

    Cay Horstmann wrote:. . . what is  0x0.1p-3?  . . .

    I had to ask JShell. What I meant about “Simple” is that the code I showed earlier won't compile with the added “x”. Not unless I remove the first underscore, too.


    Thank You very much for Your very interesting answers!
    I read the complete book "OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808" (ISBN 978-1-118-95740-0) as part of my preparation for the OCA exam, but it even contains the wrong syntax definition for the "_" in numeric literals. They write on page 22: "You can add underscores anywhere except at the beginning of a literal, the end of a literal, right before a decimal point, or right after a decimal point." Your example with the 0x_000_000_012 literal shows that the authors are wrong and the compiler says: "Underscores have to be located within digits". So the compiles tells me a better syntax definition than the authors did, and it is even much shorter and succinct. Literals like "0x0.1p-3" are not even mentioned in the book. I tested this literal, too, any luckily I know now the meaning. I am not very convinced that the book is a really good preparation for the OCA exam. Therefore I already try to get more and better information in other books.
    I can also understand the criticism ("intellectual bancrupcy") concering the certification questions. I already read many mock certification exam questions for the OCAJP exam. Some of them were valuable for me as they sharpened my knowledge on details about the language but I don't think that a professional Java developer has to think like a compiler as it is expected from a testee in the exam. In real developer's life the IDE already tells You syntax errors and in most cases they are obvious. E.g. once I read a mock exam questions with code, and the code did not compile because in one line they wrote "string str;" but it had to be "String str;". The question was about something completely different ("What is the output of this code?"). It is obvious that it must be "String str;" but a testee can overlook such a detail in a rush. An IDE would tell You that there is a syntax error, and of course You would correct that kind of trivial typing error. Therefore such kind of questions which only try to trick the testee are not very meaningful for a Java developer's life, and don't leverage the overall quality of the developer's code.
     
    There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
    ScroogeXHTML 8.2 - easy to use RTF to HTML converter library
    https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!