Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Java OCA 8 Programmer I Study Guide (Sybex Ch 4 - p179)  RSS feed

 
Greenhorn
Posts: 2
Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Topic Protected Access

Can you please explain "member reference to the same class or a subclass" in the following context?

A member is used through a variable. This is the case on lines 10, 11, 15, and 16.
In this case, the rules for the reference type of the variable are what matter. If it is a
subclass, protected access is allowed. This works for references to the same class or a
subclass.

There is an example on pg 178

 
Marshal
Posts: 62259
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please tell us which book that is, including authors, and whether you are quoting the book exactly.
 
author & internet detective
Posts: 39084
714
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's my book (Sybex.)

The key point of that example is that you can call the same method and it can work/not work depending on how it is called. Noticed how the variable used is from one class or another in each case
 
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!