User Tools

Site Tools


interface

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
interface [2016/09/01 16:48]
178.237.8.52
interface [2016/09/02 15:12] (current)
178.237.8.52 [Modifiers]
Line 113: Line 113:
 </​code> ​ </​code> ​
  
-Because we are now treating Goldie as an Herbivore we are confident to be able to check if it is poisonous or not via the ''​isPoisonous()''​ method of the interface. But since ''​GoldFish''​ has implemented the method and changed the access modifier to something more restrictive (package private), ​from a different package ​we cannot ​now access the method and we are in trouble! ​+Because we are now treating Goldie as an Herbivore we are confident to be able to check if it is poisonous or not via the ''​isPoisonous()''​ method of the interface. But since ''​GoldFish''​ has implemented the method and changed the access modifier to something more restrictive (package private), we cannot access the method ​from a different package ​and **we are in trouble**
  
 We may die because the little Goldie may be poisonous. Java prevents this by not letting us compile! ​   We may die because the little Goldie may be poisonous. Java prevents this by not letting us compile! ​  
interface.txt ยท Last modified: 2016/09/02 15:12 by 178.237.8.52