• 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
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

defining interfaces errata item? (Java OCA 8 Programmer I Study Guide)

 
Greenhorn
Posts: 8
3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's also a mistake (typo?) on p267 rule 4 for defining interfaces:

All top-level interfaces are assumed to have public or default access, and they must include the abstract modifier in their definition.



Should be:

All top-level interfaces are assumed to have public or default access, and they may include the abstract modifier in their definition.



As per Java Language Specification, Java SE 8 Edition, section 9.1.1 Interface Modifiers:

9.1.1.1 abstract Interfaces
Every interface is implicitly abstract.
This modifier is obsolete and should not be used in new programs.


In fact, it has been obsolete even in Java Language Specification, First Edition
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's indeed an errata item. And very easy to confirm: both are valid interface declarations (and don't use the abstract keyword).

Hope it helps!
Kind regards,
Roel
 
I Danilov
Greenhorn
Posts: 8
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, all of the chapter after p267 does not include abstract keyword in interface declarations; p268 contains explanation that abstract keyword is implicit.

Though it may be noted that using abstract modifier for interfaces is not only unnecessary, but discouraged.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I Danilov wrote:Though it may be noted that using abstract modifier for interfaces is not only unnecessary, but discouraged.


True! But don't forget you are preparing for a certification exam, not for an assignment to win the cleanest code award. Meaning: although the use of the abstract keyword is discouraged in an interface definition, you still need to know this code is valid and will compile without any error.
 
author & internet detective
Posts: 39435
768
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, it took me a while to get to this. When I read this, my first reaction was that there was no way the book said that. Of course "abstract" is unnecessary and discouraged. But there it is.

Congratulations on being the second person to report an errata that actually affects meaning (vs an annoying typo.) I've given you a cow here and credited you with this finding in the errata.
 
Let me tell you a story about a man named Jed. He made this tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!