Hypothetically speaking, how could adding a protected variable in a superclass create an error in Java? -


just fun, i'm trying think of scenario in protected variable can cause compilation error. lets had class fruit , class apple inherits fruit.

and go ahead , add protected variable x in fruit, causing program no longer compile. happen if how, causing error?

x inherited apple without problems. able use inside either fruit or apple. might decide override and/or implement setter and/or getter.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -