Win a copy of Spark in Action this week in the Open Source Projects 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Error in Java OCA 8 Programmer I Study Guide, Sybex

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 175 the MotherDuck class is defined: public class MotherDuck, but the example is for default access, so the class should be: class MotherDuck omitting the public access modifier.
 
Greenhorn
Posts: 27
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tia Smith wrote:On page 175 the MotherDuck class is defined: public class MotherDuck, but the example is for default access, so the class should be: class MotherDuck omitting the public access modifier.


default access refers to class fields - String noise = "quack"; in this case.
 
Vitaliy Ovcharenko
Greenhorn
Posts: 27
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be more precise, to class members (fields and methods): noise and quack() in this example
 
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

Vitaliy Ovcharenko wrote:To be more precise, to class members (fields and methods): noise and quack() in this example


That's incorrect! noise and quack() are instance members, not class members.
 
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

Tia Smith wrote:On page 175 the MotherDuck class is defined: public class MotherDuck, but the example is for default access, so the class should be: class MotherDuck omitting the public access modifier.


You are incorrect! The example discusses the default (package private) access for members (not for classes). So the example in the book is spot-on
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic