Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Possible errata in OCP SE11 book

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I think I found an incomplete explanation in the book "OCP Oracle Certified Professional Java SE 11 by Jeanne Boyarsky and Scott Selikoff".

On page 368 of the book the following code is given:



The explanation given for the "sleep" method is:

The next method,sleep, does not compile because it is missing parentheses, (), for method arguments.


While this is true it would not result in it being able to compile. It must also be provided a body enclosed in braces or be marked abstract.
 
Marshal
Posts: 68044
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried the code? As far as I can tell there are two compiler errors in line 7:-
  • 1: Lack of (). A method name must be followed by () whether it is or isn't abstract.
  • 2: Not marked abstract, as you have noticed
  •  
    Wei-qiang Zhou
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Yes, the book only mentions one of the two compiler errors which I think is an errata. It should also mention the other compiler error or mark the method with abstract.
     
    Campbell Ritchie
    Marshal
    Posts: 68044
    258
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Not so much a misprint, more a second explanation missed out. Agree.
     
    author & internet detective
    Posts: 39880
    798
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Agreed. I've added it our private list of things that aren't wrong, but could be clearer.
     
    Are you okay? You look a little big. Maybe this tiny ad will help:
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!