Question: what is the difference between protected and public in java?
Answer: A protected member ( k ) is accessible within all classes in the same package and within subclasses in other packages. A public member ( l ) is accessible to all classes (unless it resides in a module that does not export the package it is declared in).