This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
interface [2016/09/01 14:48] 178.237.8.52 |
interface [2016/09/02 13: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! |